This commit is contained in:
Janis
2022-05-31 20:18:52 +02:00
parent 4ac45a1d9d
commit 87d77d2867
5 changed files with 155 additions and 17 deletions

View File

@@ -5,6 +5,7 @@ public class PlayerController : MonoBehaviour
Camera cam;
bool demolishMode = false;
bool movingMode = false;
private void Start()
{
@@ -13,9 +14,12 @@ public class PlayerController : MonoBehaviour
void Update()
{
// demolish
if (Input.GetButtonDown("Demolish"))
{
Debug.Log("Demolish");
demolishMode = !demolishMode;
movingMode = false;
}
if (demolishMode && Input.GetMouseButton(0) && MenuManager.AllMenusClosed())
@@ -23,5 +27,21 @@ public class PlayerController : MonoBehaviour
Vector3 postion = cam.ScreenToWorldPoint(Input.mousePosition);
GridBuildingSystem.instance.DemolishPlacedObjectTypeSO(postion);
}
// moving
if (Input.GetButtonDown("Move"))
{
Debug.Log("Move");
movingMode = !movingMode;
demolishMode = false;
}
if (movingMode && Input.GetMouseButtonDown(0) && MenuManager.AllMenusClosed())
{
Debug.Log("Moving this position");
Vector3 postion = cam.ScreenToWorldPoint(Input.mousePosition);
GridBuildingSystem.instance.SelectMovingPlacedObject(postion);
movingMode = false;
}
}
}