feat: add auto attack state

This commit is contained in:
Bragin Stepan
2026-03-03 17:34:02 +05:00
parent 7737ee3158
commit c04b0a259a
22 changed files with 377 additions and 21 deletions

View File

@@ -52,13 +52,13 @@ namespace _Project.Develop.Runtime.Entities
.AddInDeathProcess()
.AddDeathProcessInitialTime(new ReactiveVariable<float>(2))
.AddDeathProcessCurrentTime()
.AddAttackProcessInitialTime(new ReactiveVariable<float>(3))
.AddAttackProcessInitialTime(new ReactiveVariable<float>(1))
.AddAttackProcessCurrentTime()
.AddInAttackProcess()
.AddStartAttackRequest()
.AddStartAttackEvent()
.AddEndAttackEvent()
.AddAttackDelayTime(new ReactiveVariable<float>(2))
.AddAttackDelayTime(new ReactiveVariable<float>(1))
.AddAttackDelayEndEvent()
.AddInstantAttackDamage(new ReactiveVariable<float>(50))
.AddAttackCanceledEvent()
@@ -102,9 +102,6 @@ namespace _Project.Develop.Runtime.Entities
.AddMustCancelAttack(mustCancelAttack);
entity
.AddSystem(new AttackByInputSystem(_playerInput))
.AddSystem(new MoveDirectionByInputSystem(_playerInput))
.AddSystem(new RotateDirectionByMoveInputSystem(_playerInput))
.AddSystem(new RigidbodyMovementSystem())
.AddSystem(new RigidbodyRotationSystem())

View File

@@ -1682,5 +1682,29 @@ namespace _Project.Develop.Runtime.Entities
return AddComponent(new _Project.Develop.Runtime.Logic.Gameplay.Features.Attack.InAttackCooldown() {Value = value});
}
public _Project.Develop.Runtime.Logic.Gameplay.Features.AI.CurrentTarget CurrentTargetC => GetComponent<_Project.Develop.Runtime.Logic.Gameplay.Features.AI.CurrentTarget>();
public _Project.Develop.Runtime.Utils.ReactiveManagement.ReactiveVariable<_Project.Develop.Runtime.Entities.Entity> CurrentTarget => CurrentTargetC.Value;
public bool TryGetCurrentTarget(out _Project.Develop.Runtime.Utils.ReactiveManagement.ReactiveVariable<_Project.Develop.Runtime.Entities.Entity> value)
{
bool result = TryGetComponent(out _Project.Develop.Runtime.Logic.Gameplay.Features.AI.CurrentTarget component);
if(result)
value = component.Value;
else
value = default(_Project.Develop.Runtime.Utils.ReactiveManagement.ReactiveVariable<_Project.Develop.Runtime.Entities.Entity>);
return result;
}
public _Project.Develop.Runtime.Entities.Entity AddCurrentTarget()
{
return AddComponent(new _Project.Develop.Runtime.Logic.Gameplay.Features.AI.CurrentTarget() { Value = new _Project.Develop.Runtime.Utils.ReactiveManagement.ReactiveVariable<_Project.Develop.Runtime.Entities.Entity>() });
}
public _Project.Develop.Runtime.Entities.Entity AddCurrentTarget(_Project.Develop.Runtime.Utils.ReactiveManagement.ReactiveVariable<_Project.Develop.Runtime.Entities.Entity> value)
{
return AddComponent(new _Project.Develop.Runtime.Logic.Gameplay.Features.AI.CurrentTarget() {Value = value});
}
}
}