Feature: per-tower construction-phase build bisuals
Adding the correct pipeline for creating the different building phases for towers. Adding a default set with primitive cubes.
This commit is contained in:
parent
a87b221d87
commit
7b93137216
16 changed files with 594 additions and 36 deletions
32
Assets/_Project/Scripts/Towers/ConstructionPhaseSet.cs
Normal file
32
Assets/_Project/Scripts/Towers/ConstructionPhaseSet.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// 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;
|
||||
}
|
||||
}
|
||||
11
Assets/_Project/Scripts/Towers/ConstructionPhaseSet.cs.meta
Normal file
11
Assets/_Project/Scripts/Towers/ConstructionPhaseSet.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c8f2a4e1b9d6437052a1e8c4f7b3d069
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -68,6 +68,11 @@ namespace TD.Towers
|
|||
"replace with a real mesh when art is available.")]
|
||||
public GameObject TowerPrefab;
|
||||
|
||||
[Tooltip("Optional per-tower construction-stage visuals shown while this tower is " +
|
||||
"being built. Leave empty to use the project-default set assigned on the " +
|
||||
"BuildSiteVisual prefab.")]
|
||||
public ConstructionPhaseSet ConstructionPhases;
|
||||
|
||||
[Tooltip("Icon shown on this tower's tile in the HUD build menu. Auto-generated from " +
|
||||
"the TowerPrefab by the 'TD/Generate Tower Icons' menu item, or assign a " +
|
||||
"Sprite manually. Null falls back to the grey placeholder icon.")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue