Click or drag to resize
OrganismState Methods

The OrganismState type exposes the following members.

Methods
  NameDescription
Public methodAddIncubationTick
Add a single tick to the current incubation period. Called by the game engine each tick after the creature starts reproducing. Once the amount of ticks hits the limit for the amount of time required to incubate a child, the creature is born, and incubation is no longer required.
Public methodAddTickToAge
Adds a single tick to the creature's current age. This is also responsible for ticking down other counters like growth and reproduction. When ticks hits the LifeSpan the creature dies, but when the other counters reach 0 the action becomes available.
Public methodBurnEnergy
Used by the game engine to burn a creature's energy depending on the various actions they perform including movement, reproduction, and growth.
Public methodCloneMutable
Derived classes must override this to return an instance of their class type that has the same state (by calling CopyStateInto)
Public methodCompareTo
Compares two organism state objects together. This method takes into account the Y position for graphical Z-Ordering purposes and can be used to sort creatures for back to front rendering.
Protected methodCopyStateInto
Derived classes must override (and call Base.CopyStateInto) if they have additional state
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGrow
This returns a clone because we need the radius to be editable and the object may not allow this because it is already in the index the object returned will have the same events as the original
Public methodHealDamage
Required override for other state classes. This method gives the creature a chance to heal some previously inflicted damage.
Public methodIncreaseRadiusTo
Used by the game engine to increase the radius of a creature to a new radius amount. Each time a creature grows this method is called to set the new radius. The new radius must be larger than the previous one, so creatures can't shrink. The radius can be increased by more than a single unit, but the current Terrarium only encompasses methods that increase a radius by a single unit.
Public methodIsAdjacentOrOverlapping

Determines if a creature is immediately next to or overlapping another creature using grid cells comparisons.

Public methodIsWithinRect
Used to compute whether or not a given state object is in an adjacent or overlapping grid cell. The extra radius can be used to extend the area used for the function to find a match and so can be used for functions like visibiliy.
Public methodKill
Called by the game engine in order to kill the current creature. Since this method can only be called when the state is mutable player's can't use the method to arbitrarily kill competing organisms.
Public methodLockSizeAndPosition
Performs a special type of immutability lock for the size and position related properties only. This is to ensure that the area of a creature isn't changed after the creature's index array position has been found in the game world.
Public methodMakeImmutable
Makes all properties immutable. Ensures that the organism state cannot be changed at all by creatures with access to the state.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodResetGrowthWait
Used by the game engine to reset the amount of time the creature must wait before growing. The wait time is based on the creature's species class which uses the creature's lifepsan as a base for the growth period. This should be called after a creature has been given the chance to grow, and must wait before growing again.
Public methodResetReproductionWait
Sets the current reproduction wait of the creature to the wait time specified by the creature's species. This value will be set based on the creature's lifespan and creature type (whether carnivore or herbivore). This is called by the engine after reproduction has completed.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodStatic memberUpperBoundaryForEnergyState

Returns the amount of energy required to be at the top of a given EnergyState. It's recommended that the actual EnergyState property be used to determine the current energy bucket a creature is in.

Top
See Also