Navigation and AI merge for level 3 #445

Merged
maverickdgg merged 6 commits from Navigation into main 2023-03-25 18:49:20 +08:00
2 changed files with 17 additions and 3 deletions
Showing only changes of commit 6c1f0162e9 - Show all commits

View File

@ -18,7 +18,7 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
if (transform)
{
transform.GlobalPosition = aiTransform.GlobalPosition;
transform.GlobalPosition = aiTransform.GlobalPosition + aiTransform.Forward * 2.2f; ;
transform.GlobalEulerAngles = aiTransform.GlobalEulerAngles;
}
}

View File

@ -14,12 +14,14 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
float windupTime = 8.0f / 30.0f;
float holdTime = 0.3f;
float seqTime = 8.0f / 30.0f + 0.5f;
float seqTime = 8.0f / 30.0f;
float endTime = 0.5f;
bool windUp = false;
bool hold = false;
bool seq = false;
bool end = false;
public AttackState(StateMachine machine): base(machine)
{
@ -34,6 +36,7 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
windUp = true;
hold = false;
seq = false;
end = false;
timer = windupTime;
RotateToVelocity rotate = machine.GetScript<RotateToVelocity>();
@ -106,9 +109,20 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
if(timer <= 0.0f)
{
seq = false;
end = true;
animator.PlayOneShot(ai.atkSeqAnim);
timer = endTime;
}
}
else if(end)
{
if(timer <= 0.0f)
{
end = false;
AILineOfSight los = ai.GetScript<AILineOfSight>();
if(los && los.withinSight)
if (los && los.withinSight)
{
machine.SetState(typeof(ChaseState));
}