change activeDef to activeTowerDefinition so dummies like me can read the code
This commit is contained in:
parent
1d3857cb00
commit
6b87e03a17
1 changed files with 8 additions and 8 deletions
|
|
@ -55,7 +55,7 @@ namespace TD.Gameplay
|
|||
// ----- Active-placement state -------------------------------------
|
||||
|
||||
// Null when placement mode is inactive.
|
||||
private TowerDefinition activeDef;
|
||||
private TowerDefinition activeTowerDefinition;
|
||||
private int activeTowerTypeId;
|
||||
|
||||
// Set true by a single-shot placement submit; processed at the top of the next
|
||||
|
|
@ -112,7 +112,7 @@ namespace TD.Gameplay
|
|||
return;
|
||||
}
|
||||
|
||||
if (activeDef == null) return; // idle — nothing to do
|
||||
if (activeTowerDefinition == null) return; // idle — nothing to do
|
||||
|
||||
var mouse = Mouse.current;
|
||||
if (mouse == null) return; // no mouse device connected
|
||||
|
|
@ -137,10 +137,10 @@ namespace TD.Gameplay
|
|||
SetGhostVisible(true);
|
||||
|
||||
// Compute the footprint anchor from the hit point.
|
||||
Vector2Int anchor = ComputeAnchor(hitPoint, activeDef.FootprintSize);
|
||||
Vector2Int anchor = ComputeAnchor(hitPoint, activeTowerDefinition.FootprintSize);
|
||||
|
||||
// Position the cursor ghost at the footprint center.
|
||||
Vector3 ghostPos = GridCoordinates.GetFootprintCenterWorld(anchor, activeDef.FootprintSize);
|
||||
Vector3 ghostPos = GridCoordinates.GetFootprintCenterWorld(anchor, activeTowerDefinition.FootprintSize);
|
||||
ghostPos.y = 0.5f; // lift off the plane so the cube base sits flush
|
||||
ghostGO.transform.position = ghostPos;
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ namespace TD.Gameplay
|
|||
{
|
||||
lastAnchor = anchor;
|
||||
lastAnchorValid = true;
|
||||
lastPlacementValid = EvaluateLocalValidity(anchor, activeDef);
|
||||
lastPlacementValid = EvaluateLocalValidity(anchor, activeTowerDefinition);
|
||||
}
|
||||
|
||||
// Update ghost color.
|
||||
|
|
@ -182,7 +182,7 @@ namespace TD.Gameplay
|
|||
// Cancel any existing placement before starting a new one.
|
||||
ExitPlacementMode();
|
||||
|
||||
activeDef = def;
|
||||
activeTowerDefinition = def;
|
||||
activeTowerTypeId = towerTypeId;
|
||||
|
||||
CreateGhost(def);
|
||||
|
|
@ -193,7 +193,7 @@ namespace TD.Gameplay
|
|||
/// </summary>
|
||||
void ExitPlacementMode()
|
||||
{
|
||||
activeDef = null;
|
||||
activeTowerDefinition = null;
|
||||
activeTowerTypeId = 0;
|
||||
lastAnchorValid = false;
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ namespace TD.Gameplay
|
|||
/// <summary>
|
||||
/// True when placement mode is currently active.
|
||||
/// </summary>
|
||||
public bool IsPlacing => activeDef != null;
|
||||
public bool IsPlacing => activeTowerDefinition != null;
|
||||
|
||||
// ----- Modifier helpers -------------------------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue