Update PlacementManager.cs

This commit is contained in:
BOT Alex 2024-04-21 12:52:16 +02:00
parent 9c4bb85a88
commit 20c150e8cc
1 changed files with 4 additions and 2 deletions

View File

@ -105,7 +105,7 @@ public class TowerPlacementManager : MonoBehaviour
OnDeselectSlot(CurrentSelectedSlot, slot); OnDeselectSlot(CurrentSelectedSlot, slot);
CurrentSelectedSlot = slot; CurrentSelectedSlot = slot;
slot.gameObject.GetComponentInChildren<Renderer>().material.color = Color.blue; slot.gameObject.GetComponentInChildren<Renderer>().material.color = default;
} }
// Called when another slot is getting selected // Called when another slot is getting selected
@ -142,10 +142,13 @@ public class TowerPlacementManager : MonoBehaviour
//SilhouettedObject.SetActive(true); //SilhouettedObject.SetActive(true);
SilhouettedObject.transform.parent = slot.TowerSpawnPoint.transform; SilhouettedObject.transform.parent = slot.TowerSpawnPoint.transform;
SilhouettedObject.transform.localPosition = offset; SilhouettedObject.transform.localPosition = offset;
slot.gameObject.GetComponentInChildren<Renderer>().material.color = Color.white;
} }
public void OnSlotUnHovered(SlotManager slot, GridManager grid, int x, int y) public void OnSlotUnHovered(SlotManager slot, GridManager grid, int x, int y)
{ {
slot.gameObject.GetComponentInChildren<Renderer>().material.color = default;
Destroy(SilhouettedObject); Destroy(SilhouettedObject);
} }
@ -153,7 +156,6 @@ public class TowerPlacementManager : MonoBehaviour
{ {
Destroy(SilhouettedObject); Destroy(SilhouettedObject);
OnTowerPlaced?.Invoke(SelectedTowerInfo); OnTowerPlaced?.Invoke(SelectedTowerInfo);
} }