mirror of
https://github.com/DerTyp7/grow-ai-unity.git
synced 2025-10-30 04:47:10 +01:00
mousedown if way
This commit is contained in:
@@ -86,14 +86,26 @@ public class GridBuildingSystem : MonoBehaviour
|
|||||||
selectedGameObjectTransform.gameObject.GetComponent<SpriteRenderer>().color = Color.white;
|
selectedGameObjectTransform.gameObject.GetComponent<SpriteRenderer>().color = Color.white;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetMouseButtonDown(0))
|
if(selectedPlacedObjectTypeSO.placedObjectType == PlacedObjectTypeSO.PlacedObjectType.WAY)
|
||||||
{
|
{
|
||||||
PlaceBuilding();
|
if (Input.GetMouseButton(0))
|
||||||
|
{
|
||||||
|
PlaceBuilding();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (Input.GetMouseButtonDown(1) || Input.GetKeyDown(KeyCode.Escape))
|
else
|
||||||
|
{
|
||||||
|
if (Input.GetMouseButtonDown(0))
|
||||||
|
{
|
||||||
|
PlaceBuilding();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Input.GetMouseButtonDown(1) || Input.GetKeyDown(KeyCode.Escape))
|
||||||
{
|
{
|
||||||
DeselectBuilding();
|
DeselectBuilding();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void DemolishBuilding(Vector3 position)
|
public void DemolishBuilding(Vector3 position)
|
||||||
|
|||||||
@@ -5,7 +5,11 @@ using UnityEngine;
|
|||||||
[CreateAssetMenu()]
|
[CreateAssetMenu()]
|
||||||
public class PlacedObjectTypeSO : ScriptableObject
|
public class PlacedObjectTypeSO : ScriptableObject
|
||||||
{
|
{
|
||||||
|
public enum PlacedObjectType
|
||||||
|
{
|
||||||
|
WAY,
|
||||||
|
BULDING
|
||||||
|
}
|
||||||
public string nameString;
|
public string nameString;
|
||||||
public Transform prefab;
|
public Transform prefab;
|
||||||
//public Transform visual;
|
//public Transform visual;
|
||||||
@@ -13,7 +17,7 @@ public class PlacedObjectTypeSO : ScriptableObject
|
|||||||
public int height;
|
public int height;
|
||||||
public bool isWalkable = false;
|
public bool isWalkable = false;
|
||||||
public Sprite iconSprite;
|
public Sprite iconSprite;
|
||||||
|
public PlacedObjectType placedObjectType = PlacedObjectType.BULDING;
|
||||||
|
|
||||||
public List<Vector2Int> GetGridPositionList(Vector2Int offset)
|
public List<Vector2Int> GetGridPositionList(Vector2Int offset)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user