diff --git a/Assets/BaseTile.prefab b/Assets/BaseTile.prefab index d9d5305..06c92b4 100644 --- a/Assets/BaseTile.prefab +++ b/Assets/BaseTile.prefab @@ -75,7 +75,7 @@ SpriteRenderer: m_SortingLayerID: -2016319409 m_SortingLayer: 1 m_SortingOrder: 0 - m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} + m_Sprite: {fileID: 21300000, guid: 2700e06d970d112489ff23cfb58c3f78, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index a40f752..c2fb890 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -4906,7 +4906,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: menu: {fileID: 1395531174} - dayCountTextMeshProUGUI: {fileID: 1089918735} + dayCountTextMeshProUGUI: {fileID: 0} --- !u!212 &1278234715 SpriteRenderer: m_ObjectHideFlags: 0 @@ -5010,7 +5010,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: tile: {fileID: 4752245148499717901, guid: ea81011a3ce83fb4386934728a92ee2d, type: 3} - CameraGameObject: {fileID: 598358736} + cameraGameObject: {fileID: 0} --- !u!4 &1291863651 Transform: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/ItemStorageUI.cs b/Assets/Scripts/ItemStorageUI.cs deleted file mode 100644 index 25677d3..0000000 --- a/Assets/Scripts/ItemStorageUI.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Linq; -using UnityEngine; - -public class ItemStorageUI : MonoBehaviour { - public Transform itemsParent; - public GameObject inventoryUI; - private Inventory _inventory; - private InventorySlot[] _slots; - - private void Start() { - // Get Inventory instance and add UpdateUI method to OnItemChanged delegate - _inventory = Inventory.instance; - _inventory.onItemChangedCallback += UpdateUI; - - // Add all InventorySlot GameObjects to _slots and turn off the Inventory UI - _slots = itemsParent.GetComponentsInChildren(); - ToggleInventory(); - - // Set the icon to not be a raycast target for the Description Hovering to work - foreach(InventorySlot slot in _slots) { - slot.icon.raycastTarget = false; - } - } - - private void Update() { - // When "Inventory" button is pressed turn on/off Inventory UI - if(Input.GetButtonDown("Inventory")) { - ToggleInventory(); - } - } - - /** - * Turn on/off the Inventory UI - */ - private void ToggleInventory() { - inventoryUI.SetActive(!inventoryUI.activeSelf); - } - - /** - * Is called when something in the Inventory UI should update - */ - private void UpdateUI() { - // Add all items to the correct slots and clear the ones where no item should be - for(int i = 0; i < _slots.Length; i++) { - if(i < _inventory.items.Count) { - _slots[i].AddItem(_inventory.items.ElementAt(i).Key); - if(_inventory.items[_inventory.items.ElementAt(i).Key] > 1) { - _slots[i].amountText.text = "" + _inventory.items[_inventory.items.ElementAt(i).Key]; - } - } else { - _slots[i].ClearSlot(); - } - } - } -} diff --git a/Assets/Scripts/ItemStorageUI.cs.meta b/Assets/Scripts/ItemStorageUI.cs.meta deleted file mode 100644 index 0cf565d..0000000 --- a/Assets/Scripts/ItemStorageUI.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 21b91c5ff9ffa4d45a5e71b08b141657 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/ShopUI.cs b/Assets/Scripts/ShopUI.cs index 9e7a37f..61a9050 100644 --- a/Assets/Scripts/ShopUI.cs +++ b/Assets/Scripts/ShopUI.cs @@ -6,12 +6,12 @@ public class ShopUI : MonoBehaviour { public GameObject shopUI; private Shop _shop; private ShopSlot[] _slots; - + private void Start() { // Get Shop instance and add UpdateUI method to OnItemChanged delegate _shop = Shop.instance; _shop.onItemChangedCallback += UpdateUI; - + // Add all ShopSlot GameObjects to _slots and turn off the Shop UI _slots = itemsParent.GetComponentsInChildren(); ToggleShop(); @@ -45,7 +45,7 @@ public class ShopUI : MonoBehaviour { if(i < _shop.items.Count) { _slots[i].AddItem(_shop.items.ElementAt(i).Key); _slots[i].nameText.text = _slots[i].Item.displayName; - _slots[i].costText.text = _slots[i].Item.cost + " €"; + _slots[i].costText.text = _slots[i].Item.cost + " µ"; _slots[i].amountText.text = _shop.items[_shop.items.ElementAt(i).Key] + " #"; } else { _slots[i].ClearSlot(); diff --git a/Assets/Scripts/TileBehaviour.cs b/Assets/Scripts/TileBehaviour.cs index 833bb10..96959d3 100644 --- a/Assets/Scripts/TileBehaviour.cs +++ b/Assets/Scripts/TileBehaviour.cs @@ -5,52 +5,39 @@ using Items.TerraformingTools; using Tiles; using UnityEngine; -public class TileBehaviour : MonoBehaviour -{ - private BaseTile tile; - +public class TileBehaviour : MonoBehaviour { + private BaseTile _tile; + // Start is called before the first frame update - void Start() - { + private void Start() { Debug.Log("Created"); SetTile(new GrassTile()); - - HouseController.NewDayEvent.AddListener(tile.DayLightStep); + + HouseController.NewDayEvent.AddListener(_tile.DayLightStep); } - // Update is called once per frame - void Update() - { - - } - - void OnMouseDown() - { + private void OnMouseDown() { Debug.Log("Clicked"); - + UsableItem usable = PlayerController.instance.GetSelectedItem(); BaseTile tileToSetTo = null; - if (usable.GetType() == typeof(TerraformingTool)) - { - TerraformingTool terraformingTool = (TerraformingTool) usable; + if(usable.GetType() == typeof(TerraformingTool)) { + TerraformingTool terraformingTool = (TerraformingTool)usable; Type tileTypeToSetTo = terraformingTool.TileType; - tileToSetTo = (BaseTile) Activator.CreateInstance(tileTypeToSetTo); - } - else - { - tileToSetTo = tile.Clicked(usable); + tileToSetTo = (BaseTile)Activator.CreateInstance(tileTypeToSetTo); + } else { + tileToSetTo = _tile.Clicked(usable); Debug.Log("AMOGUS " + tileToSetTo.ToString()); } - if (tileToSetTo != null) - { + + if(tileToSetTo != null) { SetTile(tileToSetTo); } } - void SetTile(BaseTile tileToSet) - { + private void SetTile(BaseTile tileToSet) { Debug.Log("Set tile to " + tileToSet.ToString()); - tile = tileToSet; - GetComponent().color = tile.getColor; // TODO: Change to Sprite + _tile = tileToSet; + GetComponent().color = _tile.getColor; // TODO: Change to Sprite } -} +} \ No newline at end of file diff --git a/Assets/Scripts/TileController.cs b/Assets/Scripts/TileController.cs index 5049d4b..6ab7008 100644 --- a/Assets/Scripts/TileController.cs +++ b/Assets/Scripts/TileController.cs @@ -3,38 +3,25 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -public class TileController : MonoBehaviour -{ +public class TileController : MonoBehaviour { public GameObject tile; - public GameObject CameraGameObject; - + public GameObject cameraGameObject; + // Start is called before the first frame update - void Start() - { - Camera camera = CameraGameObject.GetComponent(); - Vector3 screen = camera.ViewportToWorldPoint(new Vector3(1,1,camera.nearClipPlane)); + void Start() { + Camera camera = cameraGameObject.GetComponent(); + Vector3 screen = camera.ViewportToWorldPoint(new Vector3(1, 1, camera.nearClipPlane)); int x = Convert.ToInt32(Math.Ceiling(screen.x)); int y = Convert.ToInt32(Math.Ceiling(screen.y)); - + Debug.Log(screen); - for (int xx = -x; xx <= x; xx++) - { - for (int yy = -y; yy <= y; yy++) - { - if (tile != null) - { + for(int xx = -x; xx <= x; xx++) { + for(int yy = -y; yy <= y; yy++) { + if(tile != null) { Instantiate(tile, new Vector3(xx, yy, 0), Quaternion.identity); } } } } - - // Update is called once per frame - void Update() - { - - } - - -} +} \ No newline at end of file diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 4f0557e..40769bb 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -137,12 +137,21 @@ "dependencies": {}, "url": "https://packages.unity.com" }, + "com.unity.nuget.newtonsoft-json": { + "version": "3.0.2", + "depth": 2, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, "com.unity.services.core": { - "version": "1.0.1", + "version": "1.3.1", "depth": 1, "source": "registry", "dependencies": { - "com.unity.modules.unitywebrequest": "1.0.0" + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.nuget.newtonsoft-json": "3.0.2", + "com.unity.modules.androidjni": "1.0.0" }, "url": "https://packages.unity.com" }, diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 90d6509..3dcb827 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2021.3.1f1 -m_EditorVersionWithRevision: 2021.3.1f1 (3b70a0754835) +m_EditorVersion: 2021.3.2f1 +m_EditorVersionWithRevision: 2021.3.2f1 (d6360bedb9a0)