mirror of
https://github.com/DerTyp7/industrialize-unity.git
synced 2025-10-30 21:07:11 +01:00
move
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user