mirror of
https://github.com/Bragin-Stepan/project-entity.git
synced 2026-04-19 13:09:41 +00:00
fix: attack trigger entered
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using _Project.Develop.Runtime.Entities;
|
using _Project.Develop.Runtime.Entities;
|
||||||
using _Project.Develop.Runtime.Logic.Gameplay.Features.AI.States;
|
using _Project.Develop.Runtime.Logic.Gameplay.Features.AI.States;
|
||||||
using _Project.Develop.Runtime.Logic.Gameplay.Features.Selectors;
|
|
||||||
using _Project.Develop.Runtime.Utilities.Conditions;
|
using _Project.Develop.Runtime.Utilities.Conditions;
|
||||||
using _Project.Develop.Runtime.Utils.InputManagement;
|
using _Project.Develop.Runtime.Utils.InputManagement;
|
||||||
using _Project.Develop.Runtime.Utils.ReactiveManagement;
|
using _Project.Develop.Runtime.Utils.ReactiveManagement;
|
||||||
@@ -56,6 +55,7 @@ namespace _Project.Develop.Runtime.Logic.Gameplay.Features.AI
|
|||||||
AIParallelState parallelState = new (findTargetState, teleportStateMachine);
|
AIParallelState parallelState = new (findTargetState, teleportStateMachine);
|
||||||
|
|
||||||
AIStateMachine rootStateMachine = new ();
|
AIStateMachine rootStateMachine = new ();
|
||||||
|
|
||||||
rootStateMachine.AddState(parallelState);
|
rootStateMachine.AddState(parallelState);
|
||||||
|
|
||||||
StateMachineBrain brain = new (rootStateMachine);
|
StateMachineBrain brain = new (rootStateMachine);
|
||||||
@@ -157,9 +157,10 @@ namespace _Project.Develop.Runtime.Logic.Gameplay.Features.AI
|
|||||||
return stateMachine;
|
return stateMachine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// На сколько хорошая идея дробить на маленькие стейтмашины?
|
||||||
private AIStateMachine CreateSteeringAttackStateMachine(Entity entity)
|
private AIStateMachine CreateSteeringAttackStateMachine(Entity entity)
|
||||||
{
|
{
|
||||||
AIStateMachine steeringState = CreateSteeringInputStateMachine(entity);
|
AIStateMachine steeringState = CreateSteeringInputStateMachine(entity); // просто это уже 3 по вложенности
|
||||||
PlayerInputAttackTriggerState attackTriggerState = new (entity, _playerInput);
|
PlayerInputAttackTriggerState attackTriggerState = new (entity, _playerInput);
|
||||||
|
|
||||||
AIParallelState parallelState = new (steeringState, attackTriggerState);
|
AIParallelState parallelState = new (steeringState, attackTriggerState);
|
||||||
|
|||||||
@@ -13,8 +13,12 @@ namespace _Project.Develop.Runtime.Logic.Gameplay.Features.AI.States
|
|||||||
public PlayerInputAttackTriggerState(Entity entity, IPlayerInput playerInput)
|
public PlayerInputAttackTriggerState(Entity entity, IPlayerInput playerInput)
|
||||||
{
|
{
|
||||||
_playerInput = playerInput;
|
_playerInput = playerInput;
|
||||||
|
|
||||||
_request = entity.StartAttackRequest;
|
_request = entity.StartAttackRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Enter()
|
||||||
|
{
|
||||||
|
base.Enter();
|
||||||
_playerInput.Attack.Enter += OnAttack;
|
_playerInput.Attack.Enter += OnAttack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ namespace _Project.Develop.Runtime.Logic.Gameplay.Features
|
|||||||
_hero = _entitiesFactory.CreateHero(Vector3.zero);
|
_hero = _entitiesFactory.CreateHero(Vector3.zero);
|
||||||
_brainsFactory.CreateMainHeroBrain(_hero);
|
_brainsFactory.CreateMainHeroBrain(_hero);
|
||||||
|
|
||||||
// _enemy = _entitiesFactory.CreateTeleportWizard(Vector3.zero + Vector3.forward * 5);
|
_enemy = _entitiesFactory.CreateTeleportWizard(Vector3.zero + Vector3.forward * 5);
|
||||||
// _brainsFactory.CreateDangerWizardBrain(_enemy, new LowestHealthTargetSelector(_enemy));
|
_brainsFactory.CreateDangerWizardBrain(_enemy, new LowestHealthTargetSelector(_enemy));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public void Run()
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ namespace Assets._Project.Develop.Runtime.Utilities.StateMachineCore
|
|||||||
|
|
||||||
if (_currentState == null)
|
if (_currentState == null)
|
||||||
SwitchState(_states[0]);
|
SwitchState(_states[0]);
|
||||||
|
else
|
||||||
|
_currentState.State.Enter();
|
||||||
|
|
||||||
_isRunning = true;
|
_isRunning = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user