added material types for vehicle Model
This commit is contained in:
@@ -9,8 +9,9 @@ import MaterialAnimator from '../animator/materialAnimator';
|
||||
|
||||
function VehicleInstance({ agvDetail }: any) {
|
||||
const { navMesh } = useNavMesh();
|
||||
const vehicleRef: any = useRef();
|
||||
const { isPlaying } = usePlayButtonStore();
|
||||
const { vehicles, setVehicleActive, setVehicleState, incrementVehicleLoad } = useVehicleStore();
|
||||
const { vehicles, setVehicleActive, setVehicleState, incrementVehicleLoad, setMaterialType } = useVehicleStore();
|
||||
const [currentPhase, setCurrentPhase] = useState<string>('stationed');
|
||||
const [path, setPath] = useState<[number, number, number][]>([]);
|
||||
let isIncrememtable = useRef<boolean>(true);
|
||||
@@ -45,8 +46,8 @@ function VehicleInstance({ agvDetail }: any) {
|
||||
|
||||
const increment = () => {
|
||||
if (isIncrememtable.current) {
|
||||
|
||||
incrementVehicleLoad(agvDetail.modelUuid, 10);
|
||||
setMaterialType(agvDetail.modelUuid, 'Material 1')
|
||||
isIncrememtable.current = false;
|
||||
}
|
||||
}
|
||||
@@ -72,7 +73,7 @@ function VehicleInstance({ agvDetail }: any) {
|
||||
}, 5000);
|
||||
|
||||
|
||||
if (agvDetail.currentLoad === agvDetail.point.action.loadCapacity) {
|
||||
if (agvDetail.currentLoad === agvDetail.point.action.loadCapacity && agvDetail.materialType) {
|
||||
const toDrop = computePath(
|
||||
agvDetail.point.action.pickUpPoint.position,
|
||||
agvDetail.point.action.unLoadPoint.position
|
||||
@@ -119,6 +120,7 @@ function VehicleInstance({ agvDetail }: any) {
|
||||
setVehicleState(agvDetail.modelUuid, 'idle');
|
||||
setVehicleActive(agvDetail.modelUuid, false);
|
||||
setPath([]);
|
||||
setMaterialType(agvDetail.modelUuid, null)
|
||||
vehicleStatus(agvDetail.modelUuid, 'Reached pickup point again, cycle complete');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user