Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Assets/Scripts/DoorPassage.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using UnityEngine;

// review(24.05.2024): Стоит разместить в отдельном файле
public enum Door
{
RoomDoor,
Expand Down
3 changes: 3 additions & 0 deletions Assets/Scripts/ElectricalPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Player>().penguinName == PenguinNames.Kawazaki)
isTriggered = true;
else if (isStupid && other.CompareTag("Player"))
Expand All @@ -39,6 +41,7 @@ private void OnTriggerExit2D(Collider2D other)
}
}

// review(24.05.2024): Код дублируется. Стоит выделить класс, который занимается печатью текста
private IEnumerator TypeLine()
{
panel.SetActive(true);
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Inventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/KeyboardGame/Key_1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using UnityEngine;
using UnityEngine.UI;

// review(24.05.2024): Название класса не соответствует названию файла
public class ChangeImage : MonoBehaviour
{
[Header("Image")] [SerializeField] private Image image;
Expand Down
7 changes: 6 additions & 1 deletion Assets/Scripts/KeyboardGame/TextPuzzle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ public class TextPuzzle : MonoBehaviour

void Start()
{
// review(24.05.2024): text ??= GetComponent<TMP_Text>();
if (text == null)
text = GetComponent<TMP_Text>();
}

void Update()
{
// review(24.05.2024): Правильно ли я понял, что даже если TextPuzzle не активен, он все равно будет выполнять метод Update?
if (text.text == answer)
GameState.IsOverGameKeyboard = true;
if (Input.GetKeyDown(KeyCode.Backspace) && text.text.Length > 0)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down