mirror of
https://github.com/DerTyp7/industrialize-unity.git
synced 2025-10-30 21:07:11 +01:00
a
This commit is contained in:
4
Assets/Scripts/Dictionaries/ItemDictionary.cs
Normal file
4
Assets/Scripts/Dictionaries/ItemDictionary.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
public class ItemDictionary : Dictionary<ItemSO>
|
||||
{
|
||||
public override ItemSO GetEntryById(string id) => entries.Find(entry => entry.id == id);
|
||||
}
|
||||
11
Assets/Scripts/Dictionaries/ItemDictionary.cs.meta
Normal file
11
Assets/Scripts/Dictionaries/ItemDictionary.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b622d1e196b7dd49ac167a5ab14be35
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
8
Assets/Scripts/HUD.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85e60c6cf9544ec4b894b75552d3cb91
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/Items.meta
Normal file
8
Assets/Scripts/Items.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86655ae5bc954a14fa411b0b8d0c7f04
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
7
Assets/Scripts/Items/ItemObject.cs
Normal file
7
Assets/Scripts/Items/ItemObject.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class ItemObject : ScriptableObject
|
||||
{
|
||||
public ItemSO itemSO;
|
||||
|
||||
}
|
||||
11
Assets/Scripts/Items/ItemObject.cs.meta
Normal file
11
Assets/Scripts/Items/ItemObject.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ef5c356495e3ed4c8b0df5bdb15c9d5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
Assets/Scripts/Items/ItemSO.cs
Normal file
16
Assets/Scripts/Items/ItemSO.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Items/ItemSO.cs.meta
Normal file
11
Assets/Scripts/Items/ItemSO.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91bfeda1bf899b140a446b5d5e85504c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user