PlantState Class |
Represents a plant's state during a certain tick in time. This class provides information on how much damage the plant has taken, how much energy it has left, and how tall it is.
For additional information you should look at the OrganismState class which provides information that is shared between the Plant/Animal states.
Namespace: Terrarium.Sdk.Classes.State
The PlantState type exposes the following members.
Name | Description | |
---|---|---|
![]() | PlantState |
Creates a brand new state object for a plant.
|
Name | Description | |
---|---|---|
![]() | AddIncubationTick |
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.
(Inherited from OrganismState.) |
![]() | AddTickToAge |
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.
(Inherited from OrganismState.) |
![]() | BurnEnergy |
Used by the game engine to burn a creature's energy depending
on the various actions they perform including movement, reproduction,
and growth.
(Inherited from OrganismState.) |
![]() | CloneMutable |
Clones the current plant state while resetting the immutability attribute
so that the new state can be updated with new information.
(Overrides OrganismStateCloneMutable.) |
![]() | CompareTo |
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.
(Inherited from OrganismState.) |
![]() | Equals | (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | GiveEnergy |
The amount of energy a plant gets decreases linearly as you get away from the optimal
|
![]() | Grow |
Used by the game engine in order to grow a creature. This attempts
to grow the creature's radius by one unit. It makes a copy of the
organism state rather than modifying it directly since the size and
location properties might be immutable.
(Overrides OrganismStateGrow.) |
![]() | HealDamage |
Plants heal just by getting their foodchunks back up to the maximum level -- kind of
like growing their old leaves back. This should only be called by the game engine
and so the method is protected by the immutable property.
(Overrides OrganismStateHealDamage.) |
![]() | IncreaseRadiusTo |
Increases the radius of the creature to a new radius. The game
engine calls this whenever a plant grows. Since plants have
other attributes that change the base implementation of this
method must be overriden to also update the foodChunks property.
(Overrides OrganismStateIncreaseRadiusTo(Int32).) |
![]() | IsAdjacentOrOverlapping | Determines if a creature is immediately next to or overlapping another creature using grid cells comparisons. |
![]() | IsWithinRect |
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.
(Inherited from OrganismState.) |
![]() | Kill |
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.
(Inherited from OrganismState.) |
![]() | LockSizeAndPosition |
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.
(Inherited from OrganismState.) |
![]() | MakeImmutable |
Makes all properties immutable. Ensures that the organism state
cannot be changed at all by creatures with access to the state.
(Inherited from OrganismState.) |
![]() | ResetGrowthWait |
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.
(Inherited from OrganismState.) |
![]() | ResetReproductionWait |
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.
(Inherited from OrganismState.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
![]() | ActualDirection | Determines the direction the creature is moving in degrees. This along with Speed can be used to calculate where a creature will be in the future. |
![]() | CellRadius | Determines the number of game cells a creature uses on the screen. Each grid cell is 8 pixels in width and height. |
![]() | CurrentMaxFoodChunks | Returns the number of food chunks this plant represents if it hasn't taken any damage. This along with the PercentInjured property can be used to compute the total remaining food chunks for a plant. |
![]() | CurrentMoveToAction |
Retrieves information about the creature's current movement vector.
If the creature is moving this value will always be non null, and
null if the creature isn't currently moving. This is used by the
game engine since movement can encompass many turns.
(Inherited from OrganismState.) |
![]() | CurrentReproduceAction |
Used to obtain or modify the current action representing
the creature's reproduction status. If this value is not
null then the creature is reproducing.
(Inherited from OrganismState.) |
![]() | DeathReason | Describes the reason why the creature died. This is most often OldAge, Starvation, Killed, or Sickness. If the creature is not dead yet then the value will be NotDead. |
![]() | EnergyState | Determine the current energy state of a creature by comparing the current amount of stored energy versus the various energy buckets. |
![]() | FoodChunks | Determines the amount of food value this creature represents. This can be used to determine if attacking a creature will be worth the effort. |
![]() | Generation | Generation will be 0 the first time a creature is introduced. Each offspring of a creature will be labeled with its generation plus one. This helps define the longevity of a creature. |
![]() | GridX | Retrieves the creature's current grid location. This is useful for movement algorithms and is used by the engine for computing organism location in a fast and memory efficient manner. |
![]() | GridY | Retrieves the creature's current grid location. This is useful for movement algorithms and is used by the engine for computing organism location in a fast and memory efficient manner. |
![]() | GrowthWait | Determines the amount of time in game ticks a creature must wait before they are able to grow. If a creature is not yet mature, and the GrowthWait is 0, then it is possible the creature does not have enough energy or enough space in order to grow. This should be remedied quickly. |
![]() | Height | Returns the height of the plant. |
![]() | ID | A string number in the form of a GUID that uniquely represents this creature in the EcoSystem. |
![]() | IncubationTicks | Determines the number of ticks the creature must wait before it has finished reproducing. If your creature just needs to know if it's currently reproducing use the IsIncubating property. |
![]() | IsAlive | Determines if the creature is alive or dead. This is used by Carnivores so they can find food in the form of corpses. |
![]() | IsImmutable |
Determines if the current creature state is immutable.
(Inherited from OrganismState.) |
![]() | IsIncubating | Determines if the creature is in the process of reproduction. Use IncubationTicks to find out exactly how long the creature has left to incubate. |
![]() | IsMature | Determines if the creature is mature by comparing the current Radius to the Radius it will have when mature. |
![]() | IsStopped | Determines if the creature is moving or is completely stopped. |
![]() | OrganismEvents |
When events are completed the completion actions get listed into
a collection of completed events. These are then used by the
processing functions to fire off events on the creature.
(Inherited from OrganismState.) |
![]() | PercentEnergy | Determines the decimal percentage of the amount of energy a creature currently has, versus the total amount of energy the creature can store. |
![]() | PercentInjured | Returns the amount of defoliation this plant has lived through. This is a percentage total with 100 representing a full defoliated or dead plant, and 0 representing a fully healthy plant. |
![]() | PercentLifespanRemaining | Determines the decimal percentage of the amount of life remaining a creature currently has, versus the total amount of LifeSpan. |
![]() | Position | Returns the creature's current position as a Point. |
![]() | PreviousDisplayAction |
Returns the action that the organism was performing
between the last state and this one. I.e. what ended on
this state.
(Inherited from OrganismState.) |
![]() | Radius | Determines the actual radius of the creature. This is used to determine how close to maturity a creature has gotten or in various computations on attack, defense, and movement. |
![]() | ReadyToReproduce | Determines if a creature is ready to reproduce based on the elapsed time since its previous reproduction. Use ReproductionWait to determine exactly how long the creature has to go. |
![]() | RenderInfo |
This property remains mutable even though the rest of the object is immutable
because it is used by the renderer and maintains rendering state across
worldstate instances (like whether the organism is selected or not).
(Inherited from OrganismState.) |
![]() | ReproductionWait | Determines the number of ticks the creature must wait before reproducing again. If your creature just needs to know if it's ready the ReadyToReproduce property can be used instead. |
![]() | Species | Describes the characteristics of a creature through the use of the ISpecies interface. |
![]() | Speed | Determines the speed at which the creature is moving. Useful in calculating overtake speeds for Carnivores and run-away speeds for Herbivores. |
![]() | StoredEnergy | Determines how much energy a creature has stored. This is used to compute the energy state of the creature. |
![]() | TickAge | Represents the age of a creature in game ticks. Once a creature reaches a TickAge identical to its LifeSpan the creature will die from PopulationChangeReason.OldAge. |