Game#2
Conversation
This reverts commit 33eb5ec.
After player die return on the menu
|
|
||
| private void Update() | ||
| { | ||
| transform.Translate(Vector3.left * _speed * Time.deltaTime); |
There was a problem hiding this comment.
Игрок двигается в пространстве а не препятствия на него
| try | ||
| { | ||
| transform.position = new Vector3(_player.position.x, _player.position.y, transform.position.z); | ||
| } | ||
| catch (Exception error) | ||
| { | ||
| Debug.Log(error); | ||
| } |
| Debug.Log(error); | ||
| } | ||
| } | ||
|
|
| public void AddCoin() | ||
| { | ||
| _coinsAmount++; | ||
| Debug.Log($"Coins Amount: {_coinsAmount}"); |
There was a problem hiding this comment.
Убери все эти выводы в лог, не засоряй их мусором
|
|
||
| public class Player : MonoBehaviour | ||
| { | ||
| public UnityAction<int> OnCoinsAmountChanged; |
There was a problem hiding this comment.
Перечитай наши стандарты
| } | ||
| } | ||
|
|
||
| public void UpdateJumpInput() |
There was a problem hiding this comment.
Название метода не отражает суть
| using UnityEngine; | ||
|
|
||
| [RequireComponent(typeof(Animator))] | ||
|
|
| using System.Collections.Generic; | ||
| using UnityEngine; | ||
|
|
||
| public class CoinsSpawner : MonoBehaviour |
There was a problem hiding this comment.
Дублирует спавнер препятствий
| using System.Collections.Generic; | ||
| using UnityEngine; | ||
|
|
||
| public class CoinsSpawner : MonoBehaviour |
| UpdateCameraPosition(); | ||
| } | ||
|
|
||
| public void UpdateCameraPosition() |
|
|
||
| [SerializeField] private int _health; | ||
|
|
||
| private int _coinsAmount = 0; |
|
|
||
| public class Player : MonoBehaviour | ||
| { | ||
| public event UnityAction<int> CoinsAmountChanged; |
There was a problem hiding this comment.
|
|
||
| public class Player : MonoBehaviour | ||
| { | ||
| public event UnityAction<int> CoinsAmountChanged; |
There was a problem hiding this comment.
Придумай событию предметное название. Здесь скорей что CoinAdded
| _isGrounded = true; | ||
| } | ||
|
|
||
| public void UpdateHorizontalInput() |
There was a problem hiding this comment.
Название метода не соответствует содержанию
| public void OnCollisionEnter2D() | ||
| { | ||
| _isGrounded = true; | ||
| } |
There was a problem hiding this comment.
Низкая надёжность у такого метода
| } | ||
| } | ||
|
|
||
| public void UpdateJumpInputAndCheckIsGrounded() |
There was a problem hiding this comment.
Ужасающее название метода. И почему они опять публичные?
| ChangeVelocity(_rigidBody2D.velocity.x, _yVelocity); | ||
| } | ||
|
|
||
| public void ChangeVelocity(float xVelocity , float yVelocity) |
| _player.CoinsAmountChanged -= ChangeValue; | ||
| } | ||
|
|
||
| public void ChangeValue(int value) |
There was a problem hiding this comment.
Название метода слишком общее. Так 50% методов можно назвать ChangeValue
|
|
||
| IEnumerator SpawnObstacles() | ||
| { | ||
| var waitForSecondsBetweenSpawn = new WaitForSeconds(_secondsBetweenSpawn); |
| _player.CoinAdded -= ChangeCoinsAmount; | ||
| } | ||
|
|
||
| public void ChangeCoinsAmount(int coinsAmount) |
|
|
||
| public class CoinsSpawner : Spawner | ||
| { | ||
| private int _coinsCount = 0; |
| StartCoroutine(SpawnObstacles()); | ||
| } | ||
|
|
||
| IEnumerator SpawnObstacles() |
There was a problem hiding this comment.
В чём смысл по разному реализовывать спавнер препятствий и спавнер монеток? А если их реализовать одинаково то будет дубляж, подумай как это всё обобщить
| using UnityEngine; | ||
|
|
||
| [RequireComponent(typeof(Rigidbody2D))] | ||
|
|
| SetVelocity(_rigidBody2D.velocity.x, _yVelocity); | ||
| } | ||
|
|
||
| private void SetVelocity(float xVelocity , float yVelocity) |
| [SerializeField] protected GameObject _prefab; | ||
| [SerializeField] protected Transform[] _spawnPoints; | ||
| [SerializeField] protected float _secondsBetweenSpawn; |
There was a problem hiding this comment.
protected полям это плохо ка ки пуб
No description provided.