Constructor
new Communication()
This class is responsible for managing the communication related to parcel dropping and picking up. It allows setting the dropped parcel's position, value, quantity, and the agent responsible for picking it up. It also manages the distance to the nearest base for the dropped parcel. It provides methods to reset the drop state and set the dropped parcel's details.
PropertiesName | Type | Description |
---|---|---|
droppedValue | number | The value of the dropped parcel. |
droppedQuantity | number | The quantity of the dropped parcel. |
agentToPickup | string | The ID of the agent responsible for picking up the dropped parcel. |
droppedCoord | Object | The coordinates where the parcel is dropped. |
droppedBaseDistance | number | The distance to the nearest base for the dropped parcel. |
moveAwayAgentId | string | | The ID of the agent that is moving away from the dropped parcel. |
Classes
Methods
resetDrop()
This method clears the dropped parcel's details and the agent responsible for picking it up. It also resets the coordinates and distance to the nearest base for the dropped parcel.
setDropped(position, value, quantity, agentToPickup, mapStore)
This method updates the state with the details of a dropped parcel and calculates the distance to the nearest base.
Parameters:
Name | Type | Description |
---|---|---|
position | Object | The coordinates where the parcel is dropped. |
value | number | The value of the dropped parcel. |
quantity | number | The quantity of the dropped parcel. |
agentToPickup | string | The ID of the agent responsible for picking up the parcel. |
mapStore | MapStore | An instance of MapStore to find the nearest base. |