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 -------------------------------------
|
// ----- Active-placement state -------------------------------------
|
||||||
|
|
||||||
// Null when placement mode is inactive.
|
// Null when placement mode is inactive.
|
||||||
private TowerDefinition activeDef;
|
private TowerDefinition activeTowerDefinition;
|
||||||
private int activeTowerTypeId;
|
private int activeTowerTypeId;
|
||||||
|
|
||||||
// Set true by a single-shot placement submit; processed at the top of the next
|
// Set true by a single-shot placement submit; processed at the top of the next
|
||||||
|
|
@ -112,7 +112,7 @@ namespace TD.Gameplay
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activeDef == null) return; // idle — nothing to do
|
if (activeTowerDefinition == null) return; // idle — nothing to do
|
||||||
|
|
||||||
var mouse = Mouse.current;
|
var mouse = Mouse.current;
|
||||||
if (mouse == null) return; // no mouse device connected
|
if (mouse == null) return; // no mouse device connected
|
||||||
|
|
@ -137,10 +137,10 @@ namespace TD.Gameplay
|
||||||
SetGhostVisible(true);
|
SetGhostVisible(true);
|
||||||
|
|
||||||
// Compute the footprint anchor from the hit point.
|
// 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.
|
// 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
|
ghostPos.y = 0.5f; // lift off the plane so the cube base sits flush
|
||||||
ghostGO.transform.position = ghostPos;
|
ghostGO.transform.position = ghostPos;
|
||||||
|
|
||||||
|
|
@ -150,7 +150,7 @@ namespace TD.Gameplay
|
||||||
{
|
{
|
||||||
lastAnchor = anchor;
|
lastAnchor = anchor;
|
||||||
lastAnchorValid = true;
|
lastAnchorValid = true;
|
||||||
lastPlacementValid = EvaluateLocalValidity(anchor, activeDef);
|
lastPlacementValid = EvaluateLocalValidity(anchor, activeTowerDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update ghost color.
|
// Update ghost color.
|
||||||
|
|
@ -182,7 +182,7 @@ namespace TD.Gameplay
|
||||||
// Cancel any existing placement before starting a new one.
|
// Cancel any existing placement before starting a new one.
|
||||||
ExitPlacementMode();
|
ExitPlacementMode();
|
||||||
|
|
||||||
activeDef = def;
|
activeTowerDefinition = def;
|
||||||
activeTowerTypeId = towerTypeId;
|
activeTowerTypeId = towerTypeId;
|
||||||
|
|
||||||
CreateGhost(def);
|
CreateGhost(def);
|
||||||
|
|
@ -193,7 +193,7 @@ namespace TD.Gameplay
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void ExitPlacementMode()
|
void ExitPlacementMode()
|
||||||
{
|
{
|
||||||
activeDef = null;
|
activeTowerDefinition = null;
|
||||||
activeTowerTypeId = 0;
|
activeTowerTypeId = 0;
|
||||||
lastAnchorValid = false;
|
lastAnchorValid = false;
|
||||||
|
|
||||||
|
|
@ -203,7 +203,7 @@ namespace TD.Gameplay
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// True when placement mode is currently active.
|
/// True when placement mode is currently active.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsPlacing => activeDef != null;
|
public bool IsPlacing => activeTowerDefinition != null;
|
||||||
|
|
||||||
// ----- Modifier helpers -------------------------------------------
|
// ----- Modifier helpers -------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue