C# Class Terrarium.Game.AnimalWorldBoundary

This class implements the IAnimalWorldBoundary which is used by a creature to get information about the surrounding area. It is the interface between the animal and the world. This class is passed from the game engine to the actual creature, but we don't want them to have access to all the members. So, we implement an interface that is defined in the OrganismBase assembly, and implement the class in the TerrariumEngine assembly. Since the TerrariumEngine assembly doesn't have the AllowPartiallyTrustedCallers attribute animals won't be able to call the class directly and will only be able to call the members of the interface.
Inheritance: Terrarium.Game.OrganismWorldBoundary, IAnimalWorldBoundary
Datei anzeigen Open project: eugeniomiro/Terrarium

Public Methods

Method Description
LookFor ( OrganismBase.OrganismState organismState ) : OrganismBase.OrganismState

Refreshes an organism state to the latest available state. Organism state objects can be held by an organism for many ticks, and they don't automatically update themselves. The reference held is immutable and so only represents the creature's state at the time the Scan was made and not necessarily the latest state.

LookForNoCamouflage ( OrganismBase.OrganismState organismState ) : OrganismBase.OrganismState

Provides the same features as LookFor, except does not take camouflage into account.

RefreshState ( string organismID ) : OrganismBase.OrganismState

Refresh's a state based on ID rather than a stored state object. This can be used to optimize the amount of memory required for storing creature information during serialization.

Scan ( ) : ArrayList

Scans the world in a circle around your animal's current location and returns a list of what was seen. The radius of the circle your animal looks in is determined by the number of points you applied to the EyesightPoints attribute.

Animals can be hidden by camouflage so subsequent calls to this method may return different sets of objects even if the world hasn't changed at all.

You can hold onto references to the OrganismState objects that are returned by this method indefinitely. However, they will reflect the organisms state at the point where you saw the animal -- they are not refreshed to reflect an organisms state over time. Use the LookFor() method to get an up-to-date OrganismState object.

Private Methods

Method Description
AnimalWorldBoundary ( OrganismBase.Organism animal, string ID ) : System

Creates a new animal world boundary for a given animal

Method Details

LookFor() public method

Refreshes an organism state to the latest available state. Organism state objects can be held by an organism for many ticks, and they don't automatically update themselves. The reference held is immutable and so only represents the creature's state at the time the Scan was made and not necessarily the latest state.
public LookFor ( OrganismBase.OrganismState organismState ) : OrganismBase.OrganismState
organismState OrganismBase.OrganismState The organism state that needs to be updated
return OrganismBase.OrganismState

LookForNoCamouflage() public method

Provides the same features as LookFor, except does not take camouflage into account.
public LookForNoCamouflage ( OrganismBase.OrganismState organismState ) : OrganismBase.OrganismState
organismState OrganismBase.OrganismState The organism state that needs to be updated.
return OrganismBase.OrganismState

RefreshState() public method

Refresh's a state based on ID rather than a stored state object. This can be used to optimize the amount of memory required for storing creature information during serialization.
public RefreshState ( string organismID ) : OrganismBase.OrganismState
organismID string The Unique ID of the organism.
return OrganismBase.OrganismState

Scan() public method

Scans the world in a circle around your animal's current location and returns a list of what was seen. The radius of the circle your animal looks in is determined by the number of points you applied to the EyesightPoints attribute.

Animals can be hidden by camouflage so subsequent calls to this method may return different sets of objects even if the world hasn't changed at all.

You can hold onto references to the OrganismState objects that are returned by this method indefinitely. However, they will reflect the organisms state at the point where you saw the animal -- they are not refreshed to reflect an organisms state over time. Use the LookFor() method to get an up-to-date OrganismState object.

public Scan ( ) : ArrayList
return System.Collections.ArrayList