Files
beyond/Assets/Scripts/InvectorDerivatives/bSimpleCombatAction.cs
2026-02-19 21:34:50 +01:00

41 lines
1.5 KiB
C#

using Invector.vCharacterController.AI;
using Invector.vCharacterController.AI.FSMBehaviour;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Beyond
{
public class bSimpleCombatAction : vSimpleCombatAction
{
protected override void EngageTarget(vIControlAICombat controller)
{
if (controller.currentTarget.transform == null) return;
var summoner = controller.gameObject.GetComponent<DemonBoss.Summoner.SummonerAI>();
if (summoner != null && !summoner.ShouldEngageMelee())
{
controller.Stop();
return;
}
if (controller.targetDistance <= controller.attackDistance && !controller.isBlocking)
{
controller.Stop();
if (summoner != null)
{
summoner.NotifyMeleeAttack();
}
controller.Attack();
}
else if (!controller.animatorStateInfos.HasAnyTag("Attack", "LockMovement", "CustomAction"))
{
if (engageInStrafe)
controller.StrafeMoveTo(controller.currentTarget.transform.position, (controller.currentTarget.transform.position - controller.transform.position).normalized, engageSpeed);
else controller.MoveTo(controller.currentTarget.transform.position, engageSpeed);
}
else controller.Stop();
}
}
}