Skip to content

Game.Events.HotspotFrame

Assembly: Assembly-CSharp.dll
Namespace: Game.Events

Type: struct

Base: System.ValueType, Unity.Entities.IBufferElementData, Colossal.Serialization.Entities.IEmptySerializable

Summary:
HotspotFrame is a small ECS buffer element used to store a single "frame" of hotspot data (position and velocity) for weather phenomena. It is intended to be used as elements of a DynamicBuffer on an Entity. The struct uses Unity.Mathematics.float3 for compact vector storage and is tagged with InternalBufferCapacity(4) to suggest a default internal capacity for the dynamic buffer (useful for small arrays to avoid early heap allocations). The provided constructor copies the hotspot position and velocity from a WeatherPhenomenon instance.


Fields

  • public Unity.Mathematics.float3 m_Position
    Stores the world position of the hotspot for this frame. Uses Unity.Mathematics.float3 (x, y, z) and typically comes from WeatherPhenomenon.m_HotspotPosition.

  • public Unity.Mathematics.float3 m_Velocity
    Stores the world-space velocity of the hotspot for this frame. Uses Unity.Mathematics.float3 and typically comes from WeatherPhenomenon.m_HotspotVelocity.

Properties

  • This type does not declare any properties. It is a plain data struct implementing IBufferElementData.

Constructors

  • public HotspotFrame(WeatherPhenomenon weatherPhenomenon)
    Initializes a HotspotFrame by copying the hotspot position and velocity from the provided WeatherPhenomenon instance:
  • m_Position <- weatherPhenomenon.m_HotspotPosition
  • m_Velocity <- weatherPhenomenon.m_HotspotVelocity

Methods

  • This type does not declare any methods. It relies on the value semantics of a struct and the ECS runtime for buffer handling.

Usage Example

using Unity.Entities;
using Unity.Mathematics;
using Game.Events;

// Example: adding a hotspot frame to an entity's buffer
void AddHotspotFrame(EntityManager entityManager, Entity entity, WeatherPhenomenon phenomenon)
{
    // Ensure the entity has a DynamicBuffer<HotspotFrame>
    var buffer = entityManager.GetBuffer<HotspotFrame>(entity);

    // Create and add a frame copied from the WeatherPhenomenon
    var frame = new HotspotFrame(phenomenon);
    buffer.Add(frame);
}

// In a SystemBase you might do:
protected override void OnUpdate()
{
    Entities.ForEach((Entity e, in SomeWeatherComponent wc) =>
    {
        var buffer = EntityManager.GetBuffer<HotspotFrame>(e);
        buffer.Add(new HotspotFrame(wc.WeatherPhenomenon));
    }).WithoutBurst().Run();
}

{{ Additional notes: - InternalBufferCapacity(4) is a hint for the internal small array size used by Unity's DynamicBuffer to reduce allocations for small numbers of elements. - IEmptySerializable is an annotation used by the game's serialization system; the type contains plain blittable data (float3 fields) so it serializes efficiently. - WeatherPhenomenon is an external type (not shown here) which provides m_HotspotPosition and m_HotspotVelocity fields referenced by the constructor. }}