Adding the correct pipeline for creating the different building phases for towers. Adding a default set with primitive cubes.
32 lines
1.6 KiB
C#
32 lines
1.6 KiB
C#
// Assets/_Project/Scripts/Towers/ConstructionPhaseSet.cs
|
|
using UnityEngine;
|
|
|
|
namespace TD.Towers
|
|
{
|
|
/// <summary>
|
|
/// An ordered set of construction-stage visuals a build site transitions between as a
|
|
/// tower is built — typically 3 assets (early → mid → late). A tower references its own
|
|
/// set via <see cref="TowerDefinition.ConstructionPhases"/>; build sites fall back to a
|
|
/// project-default set when a tower doesn't define one.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The entries are <b>shape</b> prefabs only. <c>BuildSiteVisual</c> applies the
|
|
/// queued (green) / constructing / paused materials and the owner tint on top, so the
|
|
/// phase assets don't need their own build-state materials. Keep them simple
|
|
/// (single material) — the build site swaps the active phase's renderer material.
|
|
/// </remarks>
|
|
[CreateAssetMenu(fileName = "ConstructionPhaseSet", menuName = "TD/Construction Phase Set")]
|
|
public class ConstructionPhaseSet : ScriptableObject
|
|
{
|
|
[Tooltip("Ordered construction-stage prefabs. Shown in sequence as the build " +
|
|
"progresses — e.g. 3 entries = early / mid / late thirds of the build.")]
|
|
[SerializeField] private GameObject[] phases;
|
|
|
|
/// <summary>Number of construction phases in this set.</summary>
|
|
public int PhaseCount => phases != null ? phases.Length : 0;
|
|
|
|
/// <summary>The phase prefab at <paramref name="index"/>, or null if out of range.</summary>
|
|
public GameObject GetPhase(int index)
|
|
=> (phases != null && index >= 0 && index < phases.Length) ? phases[index] : null;
|
|
}
|
|
}
|