23.08#51
Open
atomlg wants to merge 4 commits into
Open
Conversation
HolyMonkey
requested changes
Aug 26, 2021
Comment on lines
+9
to
+12
| [SerializeField] private Transform[] _spawnPositions; | ||
| [SerializeField] private GameObject _enemyTemplate; | ||
| [SerializeField] private Transform _parent; | ||
| [SerializeField] private PlayerSpawner _playerSpawner; |
Owner
There was a problem hiding this comment.
Этого типа поля мы ставим выше обычно
Comment on lines
+14
to
+15
| public event Action<EnemyHealth> OnEnemyDied; | ||
| public event Action OnAllEnemiesDied; |
Comment on lines
+34
to
+38
| GameObject enemy = Instantiate(_enemyTemplate, _spawnPositions[i].position, Quaternion.identity, _parent); | ||
| EnemyHealth enemyHealth = enemy.GetComponent<EnemyHealth>(); | ||
| enemyHealth.OnDied += OnDied; | ||
| EnemyMovement enemyMovement = enemy.GetComponent<EnemyMovement>(); | ||
| enemyMovement.Init(_player); |
Owner
There was a problem hiding this comment.
Нет гарантии что на шаблоне будут два этих компонента
| public void Init(Transform player) | ||
| { | ||
| _enemyHealth = GetComponent<EnemyHealth>(); | ||
| _moveTarget = Random.insideUnitCircle * _randomOffset; |
Comment on lines
+23
to
+27
| if (transform.position == _moveTarget) | ||
| _moveTarget = Random.insideUnitCircle * _randomOffset; | ||
| else | ||
| transform.position = | ||
| Vector3.MoveTowards(transform.position, _moveTarget, _maxDistanceDelta * Time.deltaTime); |
| public class EnemyMovement : MonoBehaviour | ||
| { | ||
| private Vector3 _moveTarget; | ||
| private Transform _player; |
Owner
There was a problem hiding this comment.
Зависит противника от игрока плохая идея
Comment on lines
+25
to
+34
| if (_hasMaxSpeed) | ||
| { | ||
| _currentTime -= Time.deltaTime; | ||
| if (_currentTime < 0) | ||
| { | ||
| _hasMaxSpeed = false; | ||
| _speed /= 2; | ||
| } | ||
| } | ||
|
|
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.