Skip to content

Version5#34

Open
Zlobik wants to merge 2 commits into
HolyMonkey:masterfrom
Zlobik:Version5
Open

Version5#34
Zlobik wants to merge 2 commits into
HolyMonkey:masterfrom
Zlobik:Version5

Conversation

@Zlobik
Copy link
Copy Markdown

@Zlobik Zlobik commented Feb 11, 2021

No description provided.

Comment thread Assets/Scripts/Player.cs
Comment on lines +10 to +12
public int EnemiesOnLevel { get; private set; }

public int KilledEnemys { get; private set; } = 0;
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/Scripts/Player.cs
using System.Collections;
using System.Linq;

public class Player : MonoBehaviour
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/Scripts/Player.cs
EnemiesOnLevel--;

if (EnemiesOnLevel == 0)
OnLevelPassed();
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/Scripts/Player.cs
{
if (collision.GetComponent<Square>())
{
EnemiesOnLevel--;
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 on lines +43 to +46
private void ChangeSpeed (float speed)
{
_speed = speed;
}
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 on lines +29 to +41
private IEnumerator Booster ()
{
var waitForSeconds = new WaitForSeconds(_boosterTime);
ChangeSpeed(_speed + _boosterForce);

for (int i = 0; i < 1; i++)
{
yield return waitForSeconds;
}

ChangeSpeed(_defaultSpeed);
StopCoroutine(Booster());
}
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 on lines +22 to +23
_boosterForce = squareBooster.BoosterForce;
_boosterTime = squareBooster.BoosterTime;
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.

В полях это хранить не надо, надо передать методу

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