Skip to content

Code improvements#48

Open
PETROXX wants to merge 3 commits into
HolyMonkey:masterfrom
PETROXX:Petrovich-Branch
Open

Code improvements#48
PETROXX wants to merge 3 commits into
HolyMonkey:masterfrom
PETROXX:Petrovich-Branch

Conversation

@PETROXX
Copy link
Copy Markdown

@PETROXX PETROXX commented Aug 2, 2021

No description provided.

Comment thread Assets/Group1/Scripts/EnemyMovement.cs Outdated
public class EnemyMovement : MonoBehaviour
{
private Vector3 _target;
private float _targetRadius;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это не радиус цели и где этому даётся значение?

Comment thread Assets/Group1/Scripts/Player.cs Outdated
using UnityEngine;

[RequireComponent(typeof(PlayerMovement))]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лишняя пустая строка

Comment thread Assets/Group1/Scripts/Player.cs Outdated
_game = FindObjectOfType<Game>();
}

private void Update()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

На корутинах в три строки делается

Comment thread Assets/Group1/Scripts/Player.cs Outdated
public class Player : MonoBehaviour
{
[SerializeField] private float _speed;
[SerializeField] private bool _isTimerRunning;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Подумай о необходимости этого флага

Comment thread Assets/Group1/Scripts/Player.cs Outdated
{
[SerializeField] private float _speed;
[SerializeField] private bool _isTimerRunning;
[SerializeField] private float _timer;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем это доступно для редактирования через инспектор?

Comment thread Assets/Group1/Scripts/PlayerMovement.cs Outdated
private void Update()
{

float xDir = Input.GetAxis("Horizontal");
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мы не используем сокращения

Comment thread Assets/Group1/Scripts/PlayerMovement.cs Outdated
float xDir = Input.GetAxis("Horizontal");
float yDir = Input.GetAxis("Vertical");

Vector3 moveDirection = new Vector2(xDir, yDir);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Просто direction

Comment thread Assets/Group1/Scripts/EnemyMovement.cs Outdated
{
FindNewTarget();
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лишняя пустая строка

Comment thread Assets/Group1/Scripts/Player.cs Outdated
Comment on lines +21 to +27
EnemyMovement[] enemies = FindObjectsOfType<EnemyMovement>();

if(enemies.Length == 0)
{
_game.EndGame();
enabled = false;
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем это делать каждый кадр?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants