Game.Prefabs.BulldozePrefab
Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs
Type: class
Base: PrefabBase
Summary:
Prefab class that ensures the BulldozeData component is included in the prefab's component set. It is used to mark a prefab (typically a tool prefab) with the data component required for bulldoze behavior. The class is decorated with a ComponentMenu attribute so it can be placed under the "Tools/" menu in the editor. This prefab participates in the ECS archetype construction by adding a read/write BulldozeData component to the provided component set.
Fields
- This class does not declare any instance or static fields.
{{ The class relies on inherited state from PrefabBase and does not introduce additional stored fields. }}
Properties
- This class does not declare any properties.
{{ The behavior is implemented by overriding a method rather than exposing properties. }}
Constructors
public BulldozePrefab()
{{ The default parameterless constructor is not explicitly declared in source but is provided implicitly. No special construction logic is performed; initialization would come from the base PrefabBase if needed. }}
Methods
public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
{{ Overrides PrefabBase.GetPrefabComponents to augment the prefab's component set. It calls the base implementation first, then adds a read/write ComponentType for BulldozeData so the resulting entity archetype includes BulldozeData. This ensures entities created from this prefab have the expected bulldoze-related component. The method signature uses Unity.Entities.ComponentType and a HashSet to accumulate components for the prefab. }}
Usage Example
// The class itself already implements this pattern:
[ComponentMenu("Tools/", new Type[] { })]
public class BulldozePrefab : PrefabBase
{
public override void GetPrefabComponents(HashSet<ComponentType> components)
{
base.GetPrefabComponents(components);
components.Add(ComponentType.ReadWrite<BulldozeData>());
}
}
// Example: how the engine/mod code might use the prefab's component set:
var components = new HashSet<ComponentType>();
myBulldozePrefab.GetPrefabComponents(components);
// components now contains the components required to create the prefab entity, including BulldozeData.
{{ YOUR_INFO }}