Compare commits
No commits in common. "60ca297352eb618abfd126ebf3332a058954a168" and "3b804215bc2cbcb785a99aec3f3e161c6f26cbd5" have entirely different histories.
60ca297352
...
3b804215bc
|
@ -16,9 +16,7 @@ public class TowerPlacementManager : MonoBehaviour
|
|||
|
||||
// Section: Mouse
|
||||
private SlotManager CurrentSelectedSlot;
|
||||
private SlotManager CurrentHovered; // Not implemented
|
||||
|
||||
private int CurrentRotation = 0; // 0, 1, 2, 3
|
||||
private SlotManager CurrentHovered;
|
||||
|
||||
private GameObject SilhouettedObject;
|
||||
|
||||
|
@ -36,20 +34,6 @@ public class TowerPlacementManager : MonoBehaviour
|
|||
OnSpawnGridRequested?.Invoke(this);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.R) && Input.GetKey(KeyCode.LeftShift))
|
||||
{
|
||||
CurrentRotation--;
|
||||
CurrentRotation = CurrentRotation % 4;
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.R))
|
||||
{
|
||||
CurrentRotation++;
|
||||
CurrentRotation = CurrentRotation % 4;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnSlotClicked(SlotManager slot, GridManager grid, int x, int y)
|
||||
{
|
||||
slot.gameObject.GetComponentInChildren<Renderer>().material.color = Color.blue;
|
||||
|
@ -77,9 +61,7 @@ public class TowerPlacementManager : MonoBehaviour
|
|||
|
||||
public void SpawnTowerAtSelected(GameObject towerPrefab)
|
||||
{
|
||||
var spawnedTower = Instantiate(towerPrefab, CurrentSelectedSlot.transform);
|
||||
Quaternion newRotation = Quaternion.AngleAxis(CurrentRotation * 90f, transform.up);
|
||||
spawnedTower.transform.localRotation = newRotation;
|
||||
Instantiate(towerPrefab, CurrentSelectedSlot.transform);
|
||||
}
|
||||
|
||||
public void OnSlotHovered(SlotManager slot, GridManager grid, int x, int y)
|
||||
|
@ -87,15 +69,10 @@ public class TowerPlacementManager : MonoBehaviour
|
|||
if (SilhouettedObject == null)
|
||||
SilhouettedObject = ToSilhouette(DebugTowerPrefab);
|
||||
|
||||
// Sets tower rotation
|
||||
Quaternion newRotation = Quaternion.AngleAxis(CurrentRotation * 90f, transform.up);
|
||||
SilhouettedObject.transform.localRotation = newRotation;
|
||||
|
||||
Vector3 offset = DebugTowerPrefab.transform.position;
|
||||
|
||||
//SilhouettedObject.SetActive(true);
|
||||
SilhouettedObject.transform.parent = slot.TowerSpawnPoint.transform;
|
||||
SilhouettedObject.transform.localPosition = offset;
|
||||
SilhouettedObject.transform.localPosition = Vector3.zero;
|
||||
SilhouettedObject.transform.localRotation = quaternion.identity;
|
||||
}
|
||||
|
||||
public void OnSlotUnHovered(SlotManager slot, GridManager grid, int x, int y)
|
||||
|
|
Loading…
Reference in New Issue