Game.Buildings.Student
Assembly: Game
Namespace: Game.Buildings
Type: struct
Base: System.ValueType
Implements: Unity.Entities.IBufferElementData, Colossal.Serialization.Entities.IEmptySerializable, System.IEquatable
Summary:
Represents a lightweight buffer element that holds a reference to a Unity.Entities.Entity representing a "student" in the game's building/education systems. Designed to be stored in a DynamicBuffer
Fields
-
public Unity.Entities.Entity m_Student
Holds the Entity reference for the student. This is the primary data carried by the buffer element and is typically used to look up or operate on the actual student entity in ECS systems. -
(no backing fields other than m_Student)
Properties
- This type defines no public properties. Access is via the public field m_Student and the provided implicit conversion.
Constructors
public Student(Unity.Entities.Entity student)
Initializes a new Student buffer element with the provided Entity reference. Use this to add a student entry into a DynamicBuffer.
Methods
-
public bool Equals(Student other)
Compares this instance to another Student by comparing the underlying Entity (m_Student). Returns true if both wrap the same Entity. -
public static implicit operator Unity.Entities.Entity(Student student)
Implicit conversion operator that returns the underlying m_Student Entity. Allows treating a Student instance as an Entity in contexts that accept an Entity. -
(implements IBufferElementData / IEmptySerializable marker semantics; no additional runtime methods)
Usage Example
// Example usage within an ECS system or setup code:
// Add a student Entity to a parent entity's buffer
Entity studentEntity = entityManager.CreateEntity(); // created elsewhere with required components
Entity schoolEntity = /* the parent entity that holds a DynamicBuffer<Student> */;
var buffer = entityManager.GetBuffer<Game.Buildings.Student>(schoolEntity);
buffer.Add(new Game.Buildings.Student(studentEntity));
// Retrieve the first student as an Entity using implicit conversion
Game.Buildings.Student firstStudentElement = buffer[0];
Unity.Entities.Entity firstStudentEntity = firstStudentElement; // implicit conversion
// Or directly:
Unity.Entities.Entity directEntity = buffer[0]; // implicit conversion allows this