towers fall from the sky - neat!
This commit is contained in:
parent
d14305d804
commit
362b76ae75
10 changed files with 396 additions and 219 deletions
|
|
@ -55,6 +55,18 @@ namespace TD.Gameplay
|
|||
"to exclude specific children.")]
|
||||
[SerializeField] private MeshRenderer[] tintedRenderers;
|
||||
|
||||
[Header("Landing (post-construction drop)")]
|
||||
[Tooltip("World-unit height the tower visually drops from when construction completes. " +
|
||||
"Consumed only by the client-side fall visual (TowerLandingVisual).")]
|
||||
[SerializeField] private float dropHeight = 15f;
|
||||
|
||||
[Tooltip("Seconds the fall-and-land animation takes. Single source of truth: " +
|
||||
"TowerCombat withholds targeting/attacks for exactly this long " +
|
||||
"(server-authoritative), and TowerLandingVisual uses the same value to time " +
|
||||
"its client-side animation, so the two stay in lockstep without duplicating " +
|
||||
"the number.")]
|
||||
[SerializeField] private float landingDuration = 0.4f;
|
||||
|
||||
// ----- Networked state ------------------------------------------------
|
||||
|
||||
// The TowerTypeId (index into TowerPlacementManager's catalog) for this tower.
|
||||
|
|
@ -132,6 +144,13 @@ namespace TD.Gameplay
|
|||
/// <summary>The footprint anchor tile (SW corner, world-tile coords).</summary>
|
||||
public Vector2Int AnchorTile => anchorTile.Value;
|
||||
|
||||
/// <summary>World-unit height the post-construction drop animation falls from.</summary>
|
||||
public float DropHeight => dropHeight;
|
||||
|
||||
/// <summary>Seconds the drop/land animation takes. Also how long TowerCombat withholds
|
||||
/// targeting/attacks after construction completes.</summary>
|
||||
public float LandingDuration => landingDuration;
|
||||
|
||||
// ----- ISelectable ----------------------------------------------------
|
||||
|
||||
// Absolute world-unit margin that the selection ring extends beyond the
|
||||
|
|
@ -171,6 +190,16 @@ namespace TD.Gameplay
|
|||
/// <summary>Fired on ALL peers when this tower finishes construction and spawns.</summary>
|
||||
public event System.Action OnBuiltClient;
|
||||
|
||||
/// <summary>Fired locally on this peer when the client-side fall/land animation
|
||||
/// finishes (see <see cref="TD.Combat.TowerLandingVisual"/>). Analogous to
|
||||
/// <see cref="OnBuiltClient"/>, but delayed by <see cref="LandingDuration"/>.</summary>
|
||||
public event System.Action OnLandedClient;
|
||||
|
||||
/// <summary>Called by <see cref="TD.Combat.TowerLandingVisual"/> when its local
|
||||
/// fall/land animation finishes. Purely local — never invoked on a dedicated
|
||||
/// (non-client) server, which never runs that animation.</summary>
|
||||
public void ClientNotifyLanded() => OnLandedClient?.Invoke();
|
||||
|
||||
// ----- Server-only initialization -------------------------------------
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue