Game.Net.TreeObjectAction
Assembly:
(assembly not specified in source)
Namespace: Game.Net
Type: struct
Base: System.ValueType
Summary:
Represents a simple data container for a tree-related action used by the game's systems (e.g., networking or scene updates). The struct encodes an Entity to remove, an Entity to add, and a Bounds3 describing the spatial extent associated with the add/replace action. It is a plain value type with only public fields (no properties or methods).
Fields
-
public Entity m_Remove
Holds the Entity reference that should be removed. If no remove is intended, this will typically be Entity.Null. -
public Entity m_Add
Holds the Entity reference that should be added. If no add is intended, this will typically be Entity.Null. -
public Bounds3 m_Bounds
A Bounds3 (from Colossal.Mathematics) that describes the spatial bounds related to the add or replace action. For example, this can represent the bounding box of the added tree or the area affected by the action. Defaults to the default Bounds3 when not provided.
Properties
- This struct exposes no properties; it uses public fields for data storage.
Constructors
-
public TreeObjectAction(Entity remove)
Initializes an action that only removes an entity. Sets m_Remove to the provided entity, m_Add to Entity.Null, and m_Bounds to default. -
public TreeObjectAction(Entity add, Bounds3 bounds)
Initializes an action that only adds an entity. Sets m_Add and m_Bounds to the provided values, and m_Remove to Entity.Null. -
public TreeObjectAction(Entity remove, Entity add, Bounds3 bounds)
Initializes an action that replaces (removes one and adds another) or otherwise indicates both a remove and an add with associated bounds.
Methods
- This struct declares no methods.
Usage Example
// Simple remove:
Entity toRemove = /* obtain Entity to remove */;
var removeAction = new TreeObjectAction(toRemove);
// Simple add:
Entity toAdd = /* create or obtain Entity to add */;
Bounds3 addBounds = new Bounds3(min: new float3(0,0,0), max: new float3(1,2,1));
var addAction = new TreeObjectAction(toAdd, addBounds);
// Replace (remove one entity and add another at given bounds):
Entity oldEntity = /* existing entity */;
Entity newEntity = /* new tree entity */;
var replaceAction = new TreeObjectAction(oldEntity, newEntity, addBounds);
// Reading fields:
if (removeAction.m_Remove != Entity.Null)
{
// perform removal logic
}
if (addAction.m_Add != Entity.Null)
{
// perform addition logic, using addAction.m_Bounds for placement/physics/etc.
}
Notes: - Entities use Unity.Entities.Entity, and empty/invalid entities are represented by Entity.Null. - Bounds3 comes from Colossal.Mathematics and is typically used to describe axis-aligned bounds in game-space. - This struct is a lightweight value object intended for passing simple add/remove instructions between systems (for example, networking, mod code, or update systems). Adjust usage to the threading and ECS constraints of the surrounding code (e.g., don't touch managed UnityEngine objects from jobs).