完成4种基础ai

This commit is contained in:
2024-10-17 00:46:27 +08:00
parent 4920837ed7
commit cdd391ca36
74 changed files with 1094 additions and 4449 deletions

View File

@@ -4,6 +4,7 @@
{
public override void OnEnter ()
{
this.Entity.UpdateSpeedState (true);
}
public override void OnUpdate ()

View File

@@ -0,0 +1,25 @@
using UnityEngine;
namespace Game.Component.EnemyFSM_AI
{
public class FollowDuration : EnemyFSMState
{
private AttackTimer _attackTimer;
public override void OnEnter ()
{
this.Entity.UpdateSpeedState (true);
this._attackTimer = this.Entity.GetComponent<AttackTimer> ();
this._attackTimer.StartAttack (this.Entity.EndAttack);
}
public override void OnUpdate ()
{
if (this._attackTimer.IsRunning)
{
Debug.Log ("开始追逐!");
SetAiTarget (MapContent.Instance.PlayerPosition);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4ca3a44f24814bd190225eccca7d63f0
timeCreated: 1729081419

View File

@@ -6,7 +6,7 @@ namespace Game.Component.EnemyFSM_AI
{
public override void OnEnter ()
{
this.Entity.UpdateSpeedState (true);
}
public override void OnUpdate ()

View File

@@ -0,0 +1,25 @@
using Game.Component.FsmMonoData;
namespace Game.Component.EnemyFSM_AI
{
public class PathWalk : EnemyFSMState
{
private WalkPathGroup _walkPathGroup;
public override void OnEnter ()
{
this.Entity.UpdateSpeedState (false);
this._walkPathGroup = this.Entity.GetComponent<WalkPathGroup> ();
this._walkPathGroup.InitTarget (this.Entity.transform.position);
this.SetAiTarget (this._walkPathGroup.CurTarget);
}
public override void OnUpdate ()
{
if (this._walkPathGroup.CheckNextNode (this.Entity.transform.position))
{
this.SetAiTarget (this._walkPathGroup.CurTarget);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f98a710f96914e2e8585939e12bff6d8
timeCreated: 1729096274

View File

@@ -4,6 +4,10 @@ namespace Game.Component.EnemyFSM_AI
{
public class Sleep : EnemyFSMState
{
public override void OnEnter ()
{
SetAiTarget (this.Entity.CreatePos);
//此处可设置角色动画为沉睡状态
}
}
}