Skip to content

Game.Creatures.HumanFlags

Assembly: Assembly-CSharp
Namespace: Game.Creatures

Type: enum

Base: System.UInt32

Summary: Bitmask enum used to represent discrete state flags for human/creature entities. The [Flags] attribute allows multiple states to be combined in a single uint value for efficient storage, transmission, and bitwise checks (e.g., animation, AI branching, serialization).


Fields

  • Run = 1u
    Represents that the human is running (movement state).

  • Selfies = 2u
    Indicates the human is taking a selfie or performing a selfie-related animation/behavior.

  • Emergency = 4u
    Marks the human as being in an emergency state (e.g., reacting to an incident).

  • Dead = 8u
    The human is dead; used for logic that disables typical behaviors and triggers death handling.

  • Carried = 0x10u
    The human is being carried (by another unit or vehicle), affecting movement and interaction.

  • Cold = 0x20u
    Indicates the human is cold (could influence animations, needs, or behavior).

  • Homeless = 0x40u
    Marks the human as homeless (affects AI decisions and services interactions).

  • Waiting = 0x80u
    The human is waiting (e.g., at a bus stop, in queue).

  • Sad = 0x100u
    Represents a sad emotional state; can influence animations or game logic.

  • Happy = 0x200u
    Represents a happy emotional state.

  • Angry = 0x400u
    Represents an angry emotional state.

Properties

  • No properties declared on the enum type itself.

Constructors

  • Enums do not have constructors in C#; values are assigned to the named constants above.

Methods

  • No instance or type methods declared on the enum.

Usage Example

using Game.Creatures;

public void UpdateHumanState(ref HumanFlags flags)
{
    // Set a flag
    flags |= HumanFlags.Run;

    // Clear a flag
    flags &= ~HumanFlags.Waiting;

    // Toggle a flag
    flags ^= HumanFlags.Selfies;

    // Check a flag (recommended in performance-sensitive code)
    if ((flags & HumanFlags.Dead) != 0)
    {
        // handle dead state
    }

    // Alternatively (note: Enum.HasFlag can box and be slower)
    if (flags.HasFlag(HumanFlags.Homeless))
    {
        // handle homeless state
    }

    // Store or transmit as numeric value
    uint raw = (uint)flags;
    // later:
    HumanFlags restored = (HumanFlags)raw;
}

Notes and tips: - Use bitwise checks ((flags & X) != 0) when this runs frequently to avoid boxing overhead from Enum.HasFlag. - Because the underlying type is uint, values fit into 32 bits — avoid adding flags that would exceed this range. - Combine flags to represent complex states (e.g., Run | Angry) but be careful to interpret combined meanings correctly in game logic.