Code improvements#48
Open
PETROXX wants to merge 3 commits into
Open
Conversation
HolyMonkey
requested changes
Aug 2, 2021
| public class EnemyMovement : MonoBehaviour | ||
| { | ||
| private Vector3 _target; | ||
| private float _targetRadius; |
Owner
There was a problem hiding this comment.
Это не радиус цели и где этому даётся значение?
| using UnityEngine; | ||
|
|
||
| [RequireComponent(typeof(PlayerMovement))] | ||
|
|
| _game = FindObjectOfType<Game>(); | ||
| } | ||
|
|
||
| private void Update() |
Owner
There was a problem hiding this comment.
На корутинах в три строки делается
| public class Player : MonoBehaviour | ||
| { | ||
| [SerializeField] private float _speed; | ||
| [SerializeField] private bool _isTimerRunning; |
Owner
There was a problem hiding this comment.
Подумай о необходимости этого флага
| { | ||
| [SerializeField] private float _speed; | ||
| [SerializeField] private bool _isTimerRunning; | ||
| [SerializeField] private float _timer; |
Owner
There was a problem hiding this comment.
Зачем это доступно для редактирования через инспектор?
| private void Update() | ||
| { | ||
|
|
||
| float xDir = Input.GetAxis("Horizontal"); |
| float xDir = Input.GetAxis("Horizontal"); | ||
| float yDir = Input.GetAxis("Vertical"); | ||
|
|
||
| Vector3 moveDirection = new Vector2(xDir, yDir); |
HolyMonkey
requested changes
Aug 16, 2021
| { | ||
| FindNewTarget(); | ||
| } | ||
|
|
Comment on lines
+21
to
+27
| EnemyMovement[] enemies = FindObjectsOfType<EnemyMovement>(); | ||
|
|
||
| if(enemies.Length == 0) | ||
| { | ||
| _game.EndGame(); | ||
| enabled = false; | ||
| } |
Owner
There was a problem hiding this comment.
Зачем это делать каждый кадр?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.