Skip to content

Create basic butterfly AI. - #152

Open
jevlogin wants to merge 3 commits into
FitiLsan:example/rabbit-aifrom
jevlogin:code/loginovE/butterflyAi
Open

Create basic butterfly AI.#152
jevlogin wants to merge 3 commits into
FitiLsan:example/rabbit-aifrom
jevlogin:code/loginovE/butterflyAi

Conversation

@jevlogin

@jevlogin jevlogin commented Aug 9, 2021

Copy link
Copy Markdown

Вот такой вариант бабочки пойдет?
Мне не понятно почему там каждый кадр слетает _physicsService?

@@ -0,0 +1,6 @@
public enum BehaviourStateButterfly
{
None = -1,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

CodeConvention 28: Любое перечисление должно содержать None. Если это int перечисление, то None должен соответствовать 0.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Я по этому поводу спросил, как быть? Потому что VS2022 настоятельно рекомендовала None делать равным -1 но так никто и не ответил.


public void OnEnable()
{
_physicsService = Services.SharedInstance.PhysicsService;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

тут прилетает null, потому что инициализация микросервисов происходит позже чем активируется текущий SO (в текущей ветке, инициализация выполнена в Start() )

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Да, но он при каждом апдейте обнуляется... Как это почему?!
Если мы уже сохранили ссылку на _physicsService, почему он при каждом апдейте слетает то?


public void Act(ButterflyModel butterflyModel)
{
//TODO - почему тут каждый кадр слетает _physicsService?!?!?!?!?!?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Разве в каждом? В первом кадре присваивается значение, а дальше уже в условия не попадает. Проверь у себя еще раз.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Вот именно что в каждом апдейте слетает....
Я цже все перепроверил, почему так и затянул со сдачей этого... убрал все лишнее... Оставил только бабочку... Слетает при каждом апдейте. Приходится заново инициализировать в методе Act() и что-то мне подсказывает это так и осталось в главной ветке master

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Возможно, слетает в этой ветеке. Я только что проверила в рабочей, ничего не слетает.


private void Idle(ButterflyModel butterflyModel)
{
Debug.Log($"Бабочка сидит на месте");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

На будущее: в самом проекте использовать CustomDebug

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

а у нас есть такой? )) мне то он вообще не нужен, это я так показать смену состояния

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Я не уверена, есть ли в этой ветке, но просто стоит это учитывать, если понадобится в основной ветке :)

public const string PLAYER = "Player";

public const string RABBIT = "Rabbit";
public const string BUTTERFLY = "Butterfly";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Зачем создавать тег, если он нигде не используется?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

используется! При создании, при коллизии у вас тут используется система тегов )) что меня жутко взбесило кажется, но уже не помню точно

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Где-то в проекте может еще и используются, а так нужно использовать Type вместо тегов


public void Act(ButterflyModel butterflyModel)
{
//TODO - почему тут каждый кадр слетает _physicsService?!?!?!?!?!?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Возможно, слетает в этой ветеке. Я только что проверила в рабочей, ничего не слетает.


private void Idle(ButterflyModel butterflyModel)
{
Debug.Log($"Бабочка сидит на месте");

Copy link
Copy Markdown
Contributor

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.

3 participants