First commit with refactoring#42
Open
kakavlya wants to merge 6 commits into
Open
Conversation
HolyMonkey
requested changes
Jun 30, 2021
|
|
||
| private void Start() | ||
| { | ||
| _target = Random.insideUnitCircle * 4; |
| using System.Collections.Generic; | ||
| using UnityEngine; | ||
|
|
||
| public class GameController : MonoBehaviour |
|
|
||
| public class GameController : MonoBehaviour | ||
| { | ||
| public static GameController Constroller; |
Owner
There was a problem hiding this comment.
Мы не используем синглтон и это корявая реализация
| public class GameController : MonoBehaviour | ||
| { | ||
| public static GameController Constroller; | ||
| private const string Message = "SendMEssage"; |
| _target.SetActive(true); | ||
| } | ||
|
|
||
| private void Update(){ |
Comment on lines
+22
to
+29
| { | ||
| _elapsedTime -= Time.deltaTime; | ||
| if (_elapsedTime < 0) | ||
| { | ||
| _timePassed = false; | ||
| _playerMover.Speed /= 2; | ||
| } | ||
| } |
Owner
There was a problem hiding this comment.
Должна быть возможность подобрать несколько бустеров за раз
| { | ||
| [SerializeField] private float _speed; | ||
|
|
||
| public float Speed { get => _speed; set => _speed = value; } |
|
|
||
| private void Update() | ||
| { | ||
| Vector3 movement = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0); |
[SerializeField] private float _speed;
public float Speed { get => _speed; set => _speed = value; }
Оставил как есть, так как через SerializedField устанавливаем _speed в Unity. Через гетер и сетер модифицируем скорость. Если это не правильно решение, какое лучше использовать ?
HolyMonkey
requested changes
Aug 16, 2021
| SetTarget(); | ||
| } | ||
|
|
||
| private void SetTarget() |
Owner
There was a problem hiding this comment.
Set должен устанавливать состояние из параметра. Почитай про CQRS
Comment on lines
+18
to
+29
| private void Update(){ | ||
| foreach (var enemy in _enemies) | ||
| { | ||
| if (enemy == null) | ||
| continue; | ||
|
|
||
| if (Vector3.Distance(_player.gameObject.gameObject.GetComponent<Transform>().position, enemy.gameObject.gameObject.transform.position) < 0.2f) | ||
| { | ||
| _player.SendMessage(Message, enemy); | ||
| } | ||
| } | ||
| } |
| if (enemy == null) | ||
| continue; | ||
|
|
||
| if (Vector3.Distance(_player.gameObject.gameObject.GetComponent<Transform>().position, enemy.gameObject.gameObject.transform.position) < 0.2f) |
Comment on lines
+22
to
+29
| { | ||
| _elapsedTime -= Time.deltaTime; | ||
| if (_elapsedTime < 0) | ||
| { | ||
| _timePassed = false; | ||
| _playerMover.Speed /= 2; | ||
| } | ||
| } |
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.