Game.Prefabs.UnlockRequirement
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: struct
Base: Unity.Entities.IBufferElementData, System.IEquatable
Summary:
Represents a single unlock requirement entry used by prefab definitions. Each element references a prefab Entity that must be unlocked (or considered) and a set of UnlockFlags describing how that requirement is interpreted. Marked with InternalBufferCapacity(0) so it is intended to be stored in a DynamicBuffer with no preallocated inline capacity.
Fields
-
public Unity.Entities.Entity m_Prefab
Holds the Entity reference to the prefab this requirement targets. Typically this is an archetype or prefab Entity used by the game to identify the unlockable item. -
public UnlockFlags m_Flags
Bitmask/enum flags (type defined elsewhere) that describe conditions or modifiers for this requirement (for example whether the requirement is mandatory, optional, or has special evaluation rules).
Properties
- None
Constructors
public UnlockRequirement(Unity.Entities.Entity prefab, UnlockFlags flags)
Creates a new UnlockRequirement with the given prefab Entity and flags.
Methods
-
public bool Equals(UnlockRequirement other)
Implements IEquatable. Compares prefab Entity and flags for equality. -
public override bool Equals(object obj)
Overrides System.Object.Equals. Returns true when obj is an UnlockRequirement and Equals(UnlockRequirement) is true. -
public override int GetHashCode()
Combines the prefab Entity hash and the flags into a hash code. Uses (m_Prefab.GetHashCode() * 397) ^ (int)m_Flags.
Usage Example
// Create a requirement instance
var requirement = new UnlockRequirement(prefabEntity, UnlockFlags.Required);
// Add to an entity's DynamicBuffer<UnlockRequirement>
var buffer = entityManager.GetBuffer<UnlockRequirement>(someEntity);
buffer.Add(requirement);
// Compare two requirements
var a = new UnlockRequirement(prefabA, UnlockFlags.Required);
var b = new UnlockRequirement(prefabA, UnlockFlags.Required);
bool equal = a.Equals(b); // true
{{ Additional notes: - InternalBufferCapacity(0) suggests these buffer elements are expected to be stored in a DynamicBuffer with capacity managed at runtime. - UnlockFlags is not defined here; consult its declaration for exact flag meanings and possible values. - Because this struct holds an Entity, ensure proper Entity lifetime management (do not reference destroyed entities). }}