diff --git a/Assets/Scripts/DoorPassage.cs b/Assets/Scripts/DoorPassage.cs index d9c9b05..aaeed14 100644 --- a/Assets/Scripts/DoorPassage.cs +++ b/Assets/Scripts/DoorPassage.cs @@ -1,5 +1,6 @@ using UnityEngine; +// review(24.05.2024): Стоит разместить в отдельном файле public enum Door { RoomDoor, diff --git a/Assets/Scripts/ElectricalPanel.cs b/Assets/Scripts/ElectricalPanel.cs index 447e173..eae1f68 100644 --- a/Assets/Scripts/ElectricalPanel.cs +++ b/Assets/Scripts/ElectricalPanel.cs @@ -20,6 +20,8 @@ private void Update() private void OnTriggerEnter2D(Collider2D other) { + // review(24.05.2024): if (!other.CompareTag("Player")) return; + // review(24.05.2024): А еще можно просто отнаследовать PlayerTrigger : BoxCollider и в нем реализовать одну и ту же проверку на игрока if (other.CompareTag("Player") && other.gameObject.GetComponent().penguinName == PenguinNames.Kawazaki) isTriggered = true; else if (isStupid && other.CompareTag("Player")) @@ -39,6 +41,7 @@ private void OnTriggerExit2D(Collider2D other) } } + // review(24.05.2024): Код дублируется. Стоит выделить класс, который занимается печатью текста private IEnumerator TypeLine() { panel.SetActive(true); diff --git a/Assets/Scripts/Inventory.cs b/Assets/Scripts/Inventory.cs index 92057dd..854bc9e 100644 --- a/Assets/Scripts/Inventory.cs +++ b/Assets/Scripts/Inventory.cs @@ -24,7 +24,7 @@ public static void Add(Item item) if (item.itemName == ItemName.Crowbar) GameState.HaveCrowbar = true; if (OnItemChangedCallback != null) - OnItemChangedCallback.Invoke (); + OnItemChangedCallback.Invoke (); // review(24.05.2024): null-propagation } public static void Remove (ItemName itemName) { diff --git a/Assets/Scripts/Item.cs b/Assets/Scripts/Item.cs index 76c60ab..e0759c6 100644 --- a/Assets/Scripts/Item.cs +++ b/Assets/Scripts/Item.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using UnityEngine; +// review(24.05.2024): Стоит разместить в отдельном файле public enum ItemName {Nail, Brick, Screwdriver, Crowbar} public class Item : MonoBehaviour diff --git a/Assets/Scripts/KeyboardGame/Key_1.cs b/Assets/Scripts/KeyboardGame/Key_1.cs index 37592ef..386b117 100644 --- a/Assets/Scripts/KeyboardGame/Key_1.cs +++ b/Assets/Scripts/KeyboardGame/Key_1.cs @@ -2,6 +2,7 @@ using UnityEngine; using UnityEngine.UI; +// review(24.05.2024): Название класса не соответствует названию файла public class ChangeImage : MonoBehaviour { [Header("Image")] [SerializeField] private Image image; diff --git a/Assets/Scripts/KeyboardGame/TextPuzzle.cs b/Assets/Scripts/KeyboardGame/TextPuzzle.cs index cfdb643..25b3d17 100644 --- a/Assets/Scripts/KeyboardGame/TextPuzzle.cs +++ b/Assets/Scripts/KeyboardGame/TextPuzzle.cs @@ -22,12 +22,14 @@ public class TextPuzzle : MonoBehaviour void Start() { + // review(24.05.2024): text ??= GetComponent(); if (text == null) text = GetComponent(); } void Update() { + // review(24.05.2024): Правильно ли я понял, что даже если TextPuzzle не активен, он все равно будет выполнять метод Update? if (text.text == answer) GameState.IsOverGameKeyboard = true; if (Input.GetKeyDown(KeyCode.Backspace) && text.text.Length > 0) @@ -38,9 +40,12 @@ void Update() if (text.text.Length == answer.Length) return; + // review(24.05.2024): Если предполагается, что числа вводятся по одному, тогда зачем тут foreach? + // Можно же через FirstOrDefault() найти нужную кнопку и с ней работать foreach (var el in Alphabet) { - if (!Input.GetKeyDown(el)) continue; + if (!Input.GetKeyDown(el)) continue; // review(24.05.2024): На новую строку + // review(24.05.2024): Я бы выделил класс-хелпер, который бы умел KeyCodes.GetDigit(KeyCode key): KeyCode -> int и скрыл бы там всю эту сложность var nexIndex = (Int32.Parse((el.ToString()[^1]).ToString()) + 2) % Alphabet.Count; var newDigit = Alphabet[nexIndex].ToString()[^1]; if (text.text.Length != 0) diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/Player.cs index f04aad6..9138a89 100644 --- a/Assets/Scripts/Player.cs +++ b/Assets/Scripts/Player.cs @@ -7,7 +7,7 @@ public class Player : MonoBehaviour public PlayerController controller; public bool isActive; - private Inventory inventory; + private Inventory inventory; // review(24.05.2024): А зачем это поле, если класс статический? private PlayerTrigger playerTrigger;