Game.NodeColor
Assembly:
Assembly-CSharp
Namespace:
Game.Net
Type:
struct NodeColor
Base:
System.ValueType
Implements: Colossal.Serialization.Entities.IEmptySerializable, Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
Represents a compact color specification for a network node used by the game's ECS (Entity Component System). The struct stores a small color index and a value (both bytes) intended for efficient storage/serialization and quick network/state queries. It is serializable via IEmptySerializable and usable as a query parameter via IQueryTypeParameter.
Fields
-
public byte m_Index
This byte typically identifies which color slot or channel this entry refers to (for example, palette index, layer, or a specific color slot on a node). Range: 0–255. -
public byte m_Value
This byte holds the color value or an index into a color table/palette. Also ranges 0–255. Interpretation depends on the consuming systems (could be an intensity, palette index, or encoded color).
Properties
- None.
This struct exposes two public fields and does not define properties.
Constructors
public NodeColor(byte index, byte value)
Creates a NodeColor with the supplied index and value. Useful for constructing the component before adding it to an entity or serializing it for network/state sync.
Methods
- None (no instance methods defined).
Behavior is defined by implemented interfaces (IComponentData for ECS usage, IQueryTypeParameter for query-time filtering, and IEmptySerializable for serialization hooks if required by the serializer infrastructure).
Usage Example
// Create a NodeColor component and attach it to an entity using the EntityManager
var color = new NodeColor(index: 1, value: 200);
entityManager.AddComponentData(entity, color);
// Read-modify-write example
var existing = entityManager.GetComponentData<NodeColor>(entity);
existing.m_Value = 255;
entityManager.SetComponentData(entity, existing);
{{ Notes: - This struct is optimized for low memory and fast serialization; both fields are bytes intentionally. - Interpretation of m_Index and m_Value is context-dependent — consult the consuming systems (rendering, network sync, or game logic) to understand exact semantics. - Because this is an IComponentData, it is intended to be used with Unity's ECS (Entities) APIs. }}