Method | Description | |
---|---|---|
AddOrganism ( OrganismBase.OrganismState state ) : void |
Should only be called by the GameEngine.
|
|
BuildIndex ( ) : void |
Build the cell index.
|
|
ClearIndex ( ) : void |
Clear the current cell index.
|
|
DuplicateMutable ( ) : object |
Copies the object, but not the isImmutable bit. Makes a newly immutable copy.
|
|
FillCells ( OrganismBase.OrganismState state, int cellX, int cellY, int cellRadius, System.Boolean clear ) : void |
Fills in the appropriate grid cells in our CellIndex given the organism state.
|
|
FindOrganisms ( int x1, int x2, int y1, int y2 ) : |
Find organisms with the given rectangular area.
|
|
FindOrganismsInCells ( int minGridX, int maxGridX, int minGridY, int maxGridY ) : |
Finds all organisms within a range of cells.
|
|
FindOrganismsInView ( OrganismBase.OrganismState state, int radius ) : |
Find a list of organisms within the view of the given organism.
|
|
GetAvailableLight ( OrganismBase.PlantState plant ) : int |
Percentage of light reaching this plant. We assume the sun moves from east to west directly overhead We get a rough estimation like this: Get all plants with a certain radius whose radius blocks any East-West vector that intersects any part of the radius of the plant in question -- assume they block it completely Figure out which blocks it at the highest angle. Discount the amount of light the plant sees by angle / 180
|
|
GetOrganismState ( string organismID ) : OrganismBase.OrganismState |
Retrieve the organism state from the world state for the given ID.
|
|
IsGridCellOccupied ( int cellX, int cellY ) : System.Boolean |
Used to determine if a grid cell is occupied.
|
|
MakeImmutable ( ) : void |
Makes all portions of the world state immutable including all organism state objects.
|
|
OnlyOverlapsSelf ( OrganismBase.OrganismState state ) : System.Boolean |
Make sure the organism only overlaps itself and not other organisms.
|
|
RefreshOrganism ( OrganismBase.OrganismState state ) : void |
Should only be called by the game engine. Should be called if the state of the organism changes.
|
|
RemoveOrganism ( string organismID ) : void |
Should only be called by the game engine. Removes an organism from the world state.
|
|
WorldState ( int gridWidth, int gridHeight ) : System |
Creates a new world state with the given number of grid cells.
|
Method | Description | |
---|---|---|
buildIndexInternal ( bool isDeserializing ) : void |
Builds the cell index.
|
public AddOrganism ( OrganismBase.OrganismState state ) : void | ||
state | OrganismBase.OrganismState | The state of the organism to add. |
return | void |
public FillCells ( OrganismBase.OrganismState state, int cellX, int cellY, int cellRadius, System.Boolean clear ) : void | ||
state | OrganismBase.OrganismState | The state of the organism being added. |
cellX | int | The location of the organism in cells. |
cellY | int | The location of the organism in cells. |
cellRadius | int | The radius in cells of the organism. |
clear | System.Boolean | Determines if cells should be cleared or set. |
return | void |
public FindOrganisms ( int x1, int x2, int y1, int y2 ) : |
||
x1 | int | Part of the location rectangle. |
x2 | int | Part of the location rectangle. |
y1 | int | Part of the location rectangle. |
y2 | int | Part of the location rectangle. |
return |
public FindOrganismsInCells ( int minGridX, int maxGridX, int minGridY, int maxGridY ) : |
||
minGridX | int | Leftmost grid cell |
maxGridX | int | Rightmost grid cell |
minGridY | int | Topmost grid cell |
maxGridY | int | Bottommost grid cell |
return |
public FindOrganismsInView ( OrganismBase.OrganismState state, int radius ) : |
||
state | OrganismBase.OrganismState | The state of the organism to check. |
radius | int | The radius of vision. |
return |
public GetAvailableLight ( OrganismBase.PlantState plant ) : int | ||
plant | OrganismBase.PlantState | The plant to get light for. |
return | int |
public GetOrganismState ( string organismID ) : OrganismBase.OrganismState | ||
organismID | string | The ID to match an organism state. |
return | OrganismBase.OrganismState |
public IsGridCellOccupied ( int cellX, int cellY ) : System.Boolean | ||
cellX | int | The cell index. |
cellY | int | The cell index. |
return | System.Boolean |
public OnlyOverlapsSelf ( OrganismBase.OrganismState state ) : System.Boolean | ||
state | OrganismBase.OrganismState | The state of the organism to check. |
return | System.Boolean |
public RefreshOrganism ( OrganismBase.OrganismState state ) : void | ||
state | OrganismBase.OrganismState | The state of the organism to refresh. |
return | void |
public RemoveOrganism ( string organismID ) : void | ||
organismID | string | The ID of the organism that needs to be removed. |
return | void |
public WorldState ( int gridWidth, int gridHeight ) : System | ||
gridWidth | int | The width of the world state in grid cells. |
gridHeight | int | The height of the world state in grid cells. |
return | System |