Class CreatureExtensions
Static class that provides helper methods for creature mechanics.
Inheritance
Inherited Members
Namespace: Fibula.Mechanics.Contracts.Extensions
Assembly: Fibula.Mechanics.Contracts.dll
Syntax
public static class CreatureExtensions
Methods
| Improve this Doc View SourceCalculateStepDuration(ICreature, ITile)
Calculates the step duration of a creature moving from a given tile in the given direction.
Declaration
public static TimeSpan CalculateStepDuration(this ICreature creature, ITile fromTile = null)
Parameters
Type | Name | Description |
---|---|---|
ICreature | creature | The creature that's moving. |
ITile | fromTile | The tile which the creature is moving from. |
Returns
Type | Description |
---|---|
System.TimeSpan | The duration time of the step. |
LocationInFront(ICreature)
Gets the location in front of a creature.
Declaration
public static Location LocationInFront(this ICreature ofCreature)
Parameters
Type | Name | Description |
---|---|---|
ICreature | ofCreature | The creature from which to get the location in front of. |
Returns
Type | Description |
---|---|
Location | The location that's in front of a creature. |
RandomAdjacentDirection(ICreature, Boolean, Random)
Gets a random direction adjacent to the creature.
Declaration
public static Direction RandomAdjacentDirection(this ICreature ofCreature, bool includeDiagonals = false, Random rng = null)
Parameters
Type | Name | Description |
---|---|---|
ICreature | ofCreature | The creature from which to get the direction from. |
System.Boolean | includeDiagonals | A value indicating whether to pick from diagonal directions too. |
System.Random | rng | Optional. An instance of a pseudo-random number generator to use. |
Returns
Type | Description |
---|---|
Direction | The direction that's adjacent to a creature. |
RandomAdjacentLocation(ICreature, Boolean, Random)
Gets a random location adjacent to the creature.
Declaration
public static Location RandomAdjacentLocation(this ICreature ofCreature, bool includeDiagonals = false, Random rng = null)
Parameters
Type | Name | Description |
---|---|---|
ICreature | ofCreature | The creature from which to get the location from. |
System.Boolean | includeDiagonals | A value indicating whether to pick from diagonal locations too. |
System.Random | rng | Optional. An instance of a pseudo-random number generator to use. |
Returns
Type | Description |
---|---|
Location | The location that's adjacent to a creature. |
TryRetrieveTrackedOperation(ICreature, String, out IOperation)
Checks if the creature has an operation being tracked under the given identifier and outputs it if so.
Declaration
public static bool TryRetrieveTrackedOperation(this ICreature creature, string identifier, out IOperation operation)
Parameters
Type | Name | Description |
---|---|---|
ICreature | creature | The creature to check in. |
System.String | identifier | The identifier of the operation to check for. |
IOperation | operation | The operation found, if any. |
Returns
Type | Description |
---|---|
System.Boolean | True if a tracked operation was found, and false otherwise. |