Files
Dwinzo_Demo/app/src/modules/simulation/simulator/simulator.tsx
Jerald-Golden-B 7519aa90c6 feat: Implement human simulation features
- Added human event handling in the simulation, including the ability to add, update, and remove human instances.
- Introduced a new Human store to manage human states and actions.
- Updated the simulation context to include human management.
- Enhanced the Points and TriggerConnector components to support human interactions.
- Refactored existing components to integrate human-related functionalities.
- Added HumanInstance and HumanInstances components for rendering human entities in the simulation.
- Updated TypeScript definitions to include human-related types and actions.
2025-07-02 15:07:31 +05:30

39 lines
1.3 KiB
TypeScript

import { useEffect } from 'react';
import { useActionHandler } from '../actions/useActionHandler';
import { usePlayButtonStore, useResetButtonStore } from '../../../store/usePlayButtonStore';
import { determineExecutionOrder } from './functions/determineExecutionOrder';
import { useProductContext } from '../products/productContext';
import { useSceneContext } from '../../scene/sceneContext';
function Simulator() {
const { selectedProductStore } = useProductContext();
const { productStore } = useSceneContext();
const { products, getProductById } = productStore();
const { handleAction } = useActionHandler();
const { selectedProduct } = selectedProductStore();
const { isPlaying } = usePlayButtonStore();
const { isReset } = useResetButtonStore();
useEffect(() => {
if (!isPlaying || isReset || !selectedProduct.productUuid) return;
const product = getProductById(selectedProduct.productUuid);
if (!product) return;
const executionOrder = determineExecutionOrder([product]);
executionOrder.forEach(point => {
const action = 'actions' in point ? point.actions[0] : point.action;
handleAction(action);
});
}, [products, isPlaying, isReset, selectedProduct]);
return (
<>
</>
);
}
export default Simulator;