diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 95b802c..6f3e5e0 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -1979,63 +1979,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 5719971c822f74e4ca86130b5e77b1d5, type: 3} ---- !u!1001 &495860598 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 2510115116361252817, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_Name - value: Cow (2) - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_RootOrder - value: 12 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalPosition.x - value: 1.94 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalPosition.y - value: -3.21 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} --- !u!1 &496797767 GameObject: m_ObjectHideFlags: 0 @@ -9412,63 +9355,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &1840846247 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 2510115116361252817, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_Name - value: Cow (1) - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_RootOrder - value: 11 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalPosition.x - value: 1.31 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalPosition.y - value: -1.48 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} --- !u!1001 &1856825636 PrefabInstance: m_ObjectHideFlags: 0 @@ -9681,63 +9567,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 44dae5fbdb6f7df4f93a10807f66956f, type: 3} ---- !u!1001 &1889531549 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 2510115116361252817, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_Name - value: Cow (3) - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_RootOrder - value: 13 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalPosition.x - value: -0.61 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalPosition.y - value: -2.7 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 547dbbf4c5377dc409dfea772c096434, type: 3} --- !u!1 &1894722676 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Shop/AnimalShop.cs b/Assets/Scripts/Shop/AnimalShop.cs index 1391c42..77dcd75 100644 --- a/Assets/Scripts/Shop/AnimalShop.cs +++ b/Assets/Scripts/Shop/AnimalShop.cs @@ -1,8 +1,6 @@ using UnityEngine; namespace Shop { - - public class AnimalShop : ElementStorage { #region Singleton diff --git a/Assets/Scripts/Shop/AnimalShopSlot.cs b/Assets/Scripts/Shop/AnimalShopSlot.cs index 3de548c..37ba048 100644 --- a/Assets/Scripts/Shop/AnimalShopSlot.cs +++ b/Assets/Scripts/Shop/AnimalShopSlot.cs @@ -2,7 +2,6 @@ using TMPro; using UnityEngine; namespace Shop { - public class AnimalShopSlot : ElementStorageSlot { public TextMeshProUGUI nameText; public TextMeshProUGUI costText; @@ -16,8 +15,8 @@ namespace Shop { } /** - * Clears the Shop Slot - */ + * Clears the Shop Slot + */ public override void ClearSlot() { nameText.text = ""; costText.text = ""; @@ -26,8 +25,8 @@ namespace Shop { } /** - * Gets called when the Shop Slot is clicked - */ + * Gets called when the Shop Slot is clicked + */ public override void UseElement() { if(Element) { if(_playerController.Money >= Element.price) { @@ -46,6 +45,9 @@ namespace Shop { } } + /** + * Places cow randomly on Screen + */ private void PlaceCowRandomlyOnScreen() { float spawnY = Random.Range (Camera.main.ScreenToWorldPoint(new Vector2(0, 0)).y, diff --git a/Assets/Scripts/Shop/ItemShop.cs b/Assets/Scripts/Shop/ItemShop.cs index f3f8b8c..90d8b9e 100644 --- a/Assets/Scripts/Shop/ItemShop.cs +++ b/Assets/Scripts/Shop/ItemShop.cs @@ -1,8 +1,6 @@ using UnityEngine; namespace Shop { - - public class ItemShop : ElementStorage { #region Singleton @@ -26,8 +24,8 @@ namespace Shop { private int _lastBoughtItemAmount; /** - * Calls ElementStorage.RemoveItem() and sets 2 Variables to remember the last bought item - */ + * Calls ElementStorage.RemoveItem() and sets 2 Variables to remember the last bought item + */ public override void RemoveElement(Item item, int amount) { base.RemoveElement(item, amount); if(itemWasBought) { @@ -36,6 +34,9 @@ namespace Shop { } } + /** + * Undo the last purchase (refund money) + */ public void UndoLastPurchase() { if(itemWasBought) { _inventory = Inventory.instance; diff --git a/Assets/Scripts/Shop/ItemShopSlot.cs b/Assets/Scripts/Shop/ItemShopSlot.cs index 63fb946..a44e736 100644 --- a/Assets/Scripts/Shop/ItemShopSlot.cs +++ b/Assets/Scripts/Shop/ItemShopSlot.cs @@ -16,8 +16,8 @@ namespace Shop { } /** - * Clears the Shop Slot - */ + * Clears the Shop Slot + */ public override void ClearSlot() { nameText.text = ""; costText.text = ""; @@ -26,8 +26,8 @@ namespace Shop { } /** - * Gets called when the Shop Slot is clicked - */ + * Gets called when the Shop Slot is clicked + */ public override void UseElement() { if(Element) { if(_playerController.Money >= Element.price) { @@ -36,7 +36,6 @@ namespace Shop { _itemShop.itemWasBought = true; // Debug.Log("Buying Item: " + Element.displayName); } - _inventory.AddElement(Element, 1); _itemShop.RemoveElement(Element, 1); } else { diff --git a/Assets/Scripts/Shop/ShopSwitcher.cs b/Assets/Scripts/Shop/ShopSwitcher.cs index 1eb6433..0d7e5a0 100644 --- a/Assets/Scripts/Shop/ShopSwitcher.cs +++ b/Assets/Scripts/Shop/ShopSwitcher.cs @@ -3,8 +3,6 @@ using UnityEngine; using UnityEngine.UI; namespace Shop { - - public class ShopSwitcher : MonoBehaviour { public Sprite animalShopSprite; public Sprite itemShopSprite; @@ -22,6 +20,10 @@ namespace Shop { viewportAnimals.SetActive(false); } + /** + * Shops get switched between Animal and Item Shop + * The Image on the Button gets changes depending at which Shop you are + */ public void SwitchShops() { // switch Shop Title text and Image of the Button if(shopTitleText.text.StartsWith("Item")) { diff --git a/Assets/Scripts/Shop/ShopUI.cs b/Assets/Scripts/Shop/ShopUI.cs index 0c0071d..9e34d4f 100644 --- a/Assets/Scripts/Shop/ShopUI.cs +++ b/Assets/Scripts/Shop/ShopUI.cs @@ -45,8 +45,8 @@ namespace Shop { } /** - * Turn on/off the Shop UI - */ + * Turn on/off the Shop UI + */ private void ToggleShop() { inventoryUI.gameObject.SetActive(!shopUI.activeSelf); HoverManager.instance.HideDescription(); @@ -54,10 +54,10 @@ namespace Shop { } /** - * Is called when something in the Shop UI should update - */ + * Is called when something in the Shop UI should update + */ private void UpdateUI() { - // Add all items to the correct slots and clear the ones where no item should be + // Add all items and animals to the correct slots and clear the ones where no item/animal should be for(int i = 0; i < _itemSlots.Length; i++) { // Item Slots if(i < _itemShop.Elements.Count) {