Show / Hide Table of Contents

    Class CreatureExtensions

    Static class that provides helper methods for creature mechanics.

    Inheritance
    System.Object
    CreatureExtensions
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Fibula.Mechanics.Contracts.Extensions
    Assembly: Fibula.Mechanics.Contracts.dll
    Syntax
    public static class CreatureExtensions

    Methods

    | Improve this Doc View Source

    CalculateStepDuration(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.

    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    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.

    • Improve this Doc
    • View Source
    Back to top Copyright © 2018-2020 | The Fibula Project
    Generated using DocFX | Jose L. Nuñez de Caceres et al.