Game.Prefabs.ManualUnlockable
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: Class
Base: UnlockableBase
Summary:
A prefab component that marks the prefab as a manually unlockable item. It is placed in the Unity Component menu under "Prefabs/Unlocking/". At initialization it adds an UnlockRequirement to the entity's UnlockRequirement buffer with the UnlockFlags.RequireAll flag, then delegates further initialization to its base class. The GetPrefabComponents override is intentionally empty (it doesn't add extra component types to the prefab archetype from this class).
Fields
- This class declares no explicit fields.
(Any required runtime state is handled via ECS buffers/components on the entity, not as C# fields on this class.)
Properties
- This class declares no properties.
(Inherited properties from UnlockableBase may still be available.)
Constructors
public ManualUnlockable()
Default parameterless constructor (implicit). No custom construction logic is provided in the class.
Methods
-
public override void GetPrefabComponents(HashSet<ComponentType> components)
Empty override. This class does not add any additional ECS component types to the prefab's component set at authoring time. -
public override void LateInitialize(EntityManager entityManager, Entity entity, List<PrefabBase> dependencies)
During late initialization, this method adds an UnlockRequirement entry to the entity's UnlockRequirement buffer with the UnlockFlags.RequireAll flag: - Calls
entityManager.GetBuffer<UnlockRequirement>(entity).Add(new UnlockRequirement(entity, UnlockFlags.RequireAll));
- Then calls
base.LateInitialize(entityManager, entity, dependencies);
This ensures the prefab/entity is registered with an unlock requirement that requires all listed conditions to be met for unlocking.
Usage Example
[ComponentMenu("Prefabs/Unlocking/", new Type[] { })]
public class ManualUnlockable : UnlockableBase
{
public override void GetPrefabComponents(HashSet<ComponentType> components)
{
// Intentionally empty: no extra prefab component types added here.
}
public override void LateInitialize(EntityManager entityManager, Entity entity, List<PrefabBase> dependencies)
{
// Add an unlock requirement that uses RequireAll semantics
entityManager.GetBuffer<UnlockRequirement>(entity).Add(new UnlockRequirement(entity, UnlockFlags.RequireAll));
base.LateInitialize(entityManager, entity, dependencies);
}
}