This commit is contained in:
Janis
2022-06-03 22:53:35 +02:00
parent 87d77d2867
commit a31c6a16dd
21 changed files with 1005 additions and 7 deletions

View File

@@ -0,0 +1,4 @@
public class ItemDictionary : Dictionary<ItemSO>
{
public override ItemSO GetEntryById(string id) => entries.Find(entry => entry.id == id);
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8b622d1e196b7dd49ac167a5ab14be35
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -207,7 +207,6 @@ public class GridBuildingSystem : MonoBehaviour
ClearConveyorPath();
List<Vector2Int> pathPoints = VectorDrawing.FindVectorPath(conveyorStartPosition, endPosition);
Debug.Log(pathPoints.Count);
foreach (Vector2Int position in pathPoints)
{
GameObject conveyorBlueprint = Instantiate(selectedPlacedObjectTypeSO.prefab.gameObject, new Vector3(position.x, position.y), Quaternion.identity);

8
Assets/Scripts/HUD.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 85e60c6cf9544ec4b894b75552d3cb91
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 86655ae5bc954a14fa411b0b8d0c7f04
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
using UnityEngine;
public class ItemObject : ScriptableObject
{
public ItemSO itemSO;
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8ef5c356495e3ed4c8b0df5bdb15c9d5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,16 @@
using UnityEngine;
[CreateAssetMenu(menuName = "ScriptableObjects/ItemSO")]
public class ItemSO : ScriptableObject
{
public string id;
public string name;
public GameObject prefab;
public Sprite icon;
public void Spawn(Vector3 position)
{
GameObject item = Instantiate(prefab, position, Quaternion.identity);
item.name = name;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 91bfeda1bf899b140a446b5d5e85504c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -17,9 +17,7 @@ public class PlayerController : MonoBehaviour
// demolish
if (Input.GetButtonDown("Demolish"))
{
Debug.Log("Demolish");
demolishMode = !demolishMode;
movingMode = false;
ToggleDemolishMode();
}
if (demolishMode && Input.GetMouseButton(0) && MenuManager.AllMenusClosed())
@@ -31,9 +29,7 @@ public class PlayerController : MonoBehaviour
// moving
if (Input.GetButtonDown("Move"))
{
Debug.Log("Move");
movingMode = !movingMode;
demolishMode = false;
ToggleMovingMode();
}
if (movingMode && Input.GetMouseButtonDown(0) && MenuManager.AllMenusClosed())
@@ -44,4 +40,18 @@ public class PlayerController : MonoBehaviour
movingMode = false;
}
}
public void ToggleDemolishMode()
{
Debug.Log("Demolish");
demolishMode = !demolishMode;
movingMode = false;
}
public void ToggleMovingMode()
{
Debug.Log("Move");
movingMode = !movingMode;
demolishMode = false;
}
}