mirror of
https://github.com/DerTyp7/industrialize-unity.git
synced 2025-10-30 12:57:11 +01:00
demolish playercontroller
This commit is contained in:
27
Assets/Scripts/Player/PlayerController.cs
Normal file
27
Assets/Scripts/Player/PlayerController.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerController : MonoBehaviour
|
||||
{
|
||||
Camera cam;
|
||||
|
||||
bool demolishMode = false;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
cam = gameObject.GetComponent<Camera>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetButtonDown("Demolish"))
|
||||
{
|
||||
demolishMode = !demolishMode;
|
||||
}
|
||||
|
||||
if (demolishMode && Input.GetMouseButton(0) && MenuManager.AllMenusClosed())
|
||||
{
|
||||
Vector3 postion = cam.ScreenToWorldPoint(Input.mousePosition);
|
||||
GridBuildingSystem.instance.DemolishPlacedObjectTypeSO(postion);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user