Skip to content

Game.Rendering.AnimatedPropID

Assembly: Assembly-CSharp (game assembly)
Namespace: Game.Rendering

Type: struct

Base: System.ValueType

Summary:
A lightweight identifier/handle for an animated prop used by the rendering system. Internally holds an integer index that represents the prop; provides a validity check, equality operators, and hash code implementation so instances can be compared or used as dictionary keys.


Fields

  • private int m_Index
    Holds the integer index that identifies the animated prop. A value < 0 is treated as invalid by the isValid property. Note that default(AnimatedPropID) will have m_Index == 0 (which this implementation considers valid), so invalid instances must be created explicitly with a negative index where needed.

Properties

  • public bool isValid { get; }
    Returns true when the underlying index is >= 0. Use this to verify that an AnimatedPropID refers to a valid/usable prop index before using it in rendering or lookup operations.

Constructors

  • public AnimatedPropID(int index)
    Creates an AnimatedPropID wrapping the provided index. Pass a negative index to create an instance that isValid will treat as invalid.

Methods

  • public static bool operator ==(AnimatedPropID a, AnimatedPropID b)
    Compares two AnimatedPropID instances by their underlying index for equality.

  • public static bool operator !=(AnimatedPropID a, AnimatedPropID b)
    Returns the inverse of the equality operator; true when indices differ.

  • public override bool Equals(object obj)
    Overrides object.Equals to allow equality checks against boxed AnimatedPropID values. Internally checks type and defers to the == operator.

  • public override int GetHashCode()
    Returns the hash code of the underlying index. Implemented so AnimatedPropID can be used as a key in hash-based collections (e.g., Dictionary, HashSet).

Usage Example

// Construct an AnimatedPropID
AnimatedPropID propA = new AnimatedPropID(5);
AnimatedPropID propB = new AnimatedPropID(5);
AnimatedPropID invalidProp = new AnimatedPropID(-1);

// Check validity
if (propA.isValid)
{
    // use propA in rendering or lookups
}

// Compare two IDs
if (propA == propB)
{
    // same underlying prop
}

// Use as dictionary key
var map = new Dictionary<AnimatedPropID, string>();
map[propA] = "Some prop metadata";

// Note: default(AnimatedPropID) has m_Index == 0 (isValid == true)
AnimatedPropID defaultId = default;
bool defaultValid = defaultId.isValid; // true