Group Class
Group Entity where agents belong.
Constructor
Item Index
Methods
- addAgent
- addAgents
- addEntity
- assignBehavior
- assignEndContext
- assignPath
- assignStartContext
- calcNewId
- CreateFromModel
- CreateFromPoint
- createGraphics
- destroy
- destroy
- destroyGraphics
- dragTo
- emptyAgents
- generateAgents
- getAnchor
- getArea
- getEndContext
- getGroup
- getPath
- getPathStartIdx
- getPos
- getRadius
- getStartContext
- in
- incrRadius
- isPathCircular
- isPathReverse
- myContextPos
- myInitPos
- removeAgents
- removeEntity
- render
- setInteractive
- setRadius
- step
- unAssign
- updatePos
Methods
addAgents
-
agentsCount
Add agents to the group.
Parameters:
-
agentsCount
Numberthe number of agents
assignEndContext
-
context
Sets the end context where agents are destroyed.
Parameters:
-
context
Context
assignPath
-
path
-
idx
Assign a path to the group and its agents.
assignStartContext
-
context
Sets the start context where agents are created
Parameters:
-
context
Context
CreateFromModel
-
group
Create a group render view from a group entity.
Parameters:
-
group
Group
Returns:
CreateFromPoint
-
x
-
y
-
parent
-
options
Create a group render and entity in a point.
Returns:
destroy
()
Destroy render group.
destroy
()
Destroy the Group
destroyGraphics
-
container
-
graphics
Destroy base graphics.
Parameters:
-
container
Pixi.Container -
graphics
Pixi.Graphics
dragTo
-
pos
-
anchor
Drag action in groups.
Parameters:
-
pos
Vec2 -
anchor
Vec2
emptyAgents
()
Removes all agents from the group.
generateAgents
-
agentsCount
-
startContext
Generate a number of agents in a context. Used internally by the group.
Returns:
newAgents
getAnchor
()
Vec2
Get render group anchor.
Returns:
anchor
getArea
()
Array
Gets the smaller rectangle area that contains the group agents
Returns:
array of two {Vec2} [[Xmin,Xmax][Ymin,YMax]]
getEndContext
()
Context
Gets the start context where agents are created
Returns:
end context
getPathStartIdx
()
Number
Gets the start index of the agents in the group path.
Returns:
start index
getPos
()
Vec2
Get group position.
Returns:
position
getStartContext
()
Context
Gets the end context where agents are destoyed optionally.
Returns:
end context
in
-
pos
Check if am agent is within a group area.
Parameters:
-
pos
Vec2
Returns:
true if inside; false otherwise
isPathCircular
()
Boolean
Gets the flag pathCircular from options.
Returns:
true if path is circular
isPathReverse
()
Boolean
Gets the flag pathReverse from options.
Returns:
true if path is reversed
myContextPos
()
Vec2
Generates a position within the group start context.
Returns:
point
myInitPos
-
pos
Generates a random init position in the group radius centered at pos.
Parameters:
-
pos
Vec2center position
Returns:
point
render
-
options
Animate group, update position and radius.
Parameters:
-
options
Objectof the group
Returns:
setInteractive
-
displayObject
Set render entity as interactive.
Parameters:
-
displayObject
Pixi.DisplayObject
step
()
Advances the simulation of the group by creating/destroying agents in its contexts.
unAssign
-
entity
Unassing a start, end contexts or a path from the group.
Parameters:
-
entity
Entity, context or path.