mirror of
https://github.com/DerTyp7/industrialize-unity.git
synced 2025-10-30 21:07: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);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Player/PlayerController.cs.meta
Normal file
11
Assets/Scripts/Player/PlayerController.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6238252f2005474e93f24acf68a7409
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user