Skip to content

Game.Vehicles.Watercraft

Assembly:
Game (exact assembly name not provided; part of the game's managed code)

Namespace:
Game.Vehicles

Type:
struct (value type)

Base:
System.ValueType
Implements: IComponentData, IQueryTypeParameter, ISerializable

Summary:
Represents a watercraft component used by the game's ECS (Entity Component System). Stores a set of flags (WatercraftFlags) describing the watercraft state/behavior and provides simple binary serialization/deserialization via the ISerializable pattern used by the game's save/load or network code.


Fields

  • public WatercraftFlags m_Flags
    Stores the watercraft's flags as a WatercraftFlags enum value. Flags are serialized as a uint.

Properties

  • This type does not expose any properties.

Constructors

  • public Watercraft(WatercraftFlags flags)
    Initializes a Watercraft instance with the provided flags.

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the current m_Flags value to the provided writer as a uint. Used by the game's serialization system to persist the component.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads a uint from the provided reader and assigns it to m_Flags (casting to WatercraftFlags). Used when loading or receiving component data.

Usage Example

// Create a Watercraft component and add it to an Entity (Unity.Entities pattern)
var watercraft = new Watercraft(WatercraftFlags.None);

// Using EntityManager (assuming a typical Unity ECS environment)
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var entity = entityManager.CreateEntity(typeof(Watercraft));
entityManager.SetComponentData(entity, watercraft);

// Serialization example (IWriter/IReader are provided by the game's serialization framework)
// Writing
watercraft.Serialize(writer);

// Reading back
var loaded = new Watercraft();
loaded.Deserialize(reader);