Game.Prefabs.PopulationAgeGroupInfo
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: System.Object
Summary:
Serializable data container that pairs a citizen age group (Game.Citizens.CitizenAge) with a UnityEngine.Color. Used to define color-coding for population age groups in prefabs, UI legends, graphs, or other systems that visualize or categorize citizens by age. The [Serializable] attribute makes instances editable in Unity inspectors and serializable in prefabs or ScriptableObjects.
Fields
-
public UnityEngine.Color m_Color
Color assigned to this age group. Displayed in the Unity Inspector when the containing object is serialized; used when rendering legends, charts or color-coding citizens in UI and debug visualizations. -
public Game.Citizens.CitizenAge m_Group
Enum value identifying the citizen age group (from Game.Citizens.CitizenAge). Typical values represent age buckets such as Child, Teen, Adult, Senior, etc., and are used as the key for mapping behaviors, visuals, and statistics to this color.
Properties
- (none)
This class exposes only public fields; there are no C# properties defined.
Constructors
public PopulationAgeGroupInfo()
Parameterless default constructor (implicit). Instances are typically created and initialized in code or configured in the Unity Inspector as part of a serialized container (for example, an array or list on a ScriptableObject or MonoBehaviour).
Methods
- (none)
No methods are defined on this simple data holder.
Usage Example
using UnityEngine;
using Game.Citizens;
using Game.Prefabs;
// Create and initialize in code
var info = new PopulationAgeGroupInfo
{
m_Color = Color.cyan,
m_Group = CitizenAge.Adult
};
// Example: populate a list for a ScriptableObject or MonoBehaviour field
public class AgeColorLegend : MonoBehaviour
{
public PopulationAgeGroupInfo[] ageGroups;
void Start()
{
// Find color for Adults
foreach (var g in ageGroups)
{
if (g.m_Group == CitizenAge.Adult)
{
Debug.Log($"Adult color: {g.m_Color}");
}
}
}
}