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.
This commit is contained in:
13
app/src/modules/simulation/human/human.tsx
Normal file
13
app/src/modules/simulation/human/human.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import HumanInstances from './instances/humanInstances'
|
||||
|
||||
function Human() {
|
||||
return (
|
||||
<>
|
||||
|
||||
<HumanInstances />
|
||||
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default Human
|
||||
@@ -0,0 +1,20 @@
|
||||
import React from 'react'
|
||||
import HumanInstance from './instance/humanInstance';
|
||||
import { useSceneContext } from '../../../scene/sceneContext';
|
||||
|
||||
function HumanInstances() {
|
||||
const { humanStore } = useSceneContext();
|
||||
const { humans } = humanStore();
|
||||
|
||||
return (
|
||||
<>
|
||||
{humans.map((human: HumanStatus) => (
|
||||
<React.Fragment key={human.modelUuid}>
|
||||
<HumanInstance human={human} />
|
||||
</React.Fragment>
|
||||
))}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default HumanInstances
|
||||
@@ -0,0 +1,15 @@
|
||||
import { useEffect } from 'react'
|
||||
|
||||
function HumanInstance({ human }: { human: HumanStatus }) {
|
||||
|
||||
useEffect(() => {
|
||||
console.log('human: ', human);
|
||||
}, [human])
|
||||
|
||||
return (
|
||||
<>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default HumanInstance
|
||||
Reference in New Issue
Block a user