You've already forked taptap2024_GJ_chidouren
完成4种基础ai
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
{
|
||||
public override void OnEnter ()
|
||||
{
|
||||
this.Entity.UpdateSpeedState (true);
|
||||
}
|
||||
|
||||
public override void OnUpdate ()
|
||||
|
||||
25
Assets/Scripts/Game/Component/EnemyFSM_AI/FollowDuration.cs
Normal file
25
Assets/Scripts/Game/Component/EnemyFSM_AI/FollowDuration.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ca3a44f24814bd190225eccca7d63f0
|
||||
timeCreated: 1729081419
|
||||
@@ -6,7 +6,7 @@ namespace Game.Component.EnemyFSM_AI
|
||||
{
|
||||
public override void OnEnter ()
|
||||
{
|
||||
|
||||
this.Entity.UpdateSpeedState (true);
|
||||
}
|
||||
|
||||
public override void OnUpdate ()
|
||||
|
||||
25
Assets/Scripts/Game/Component/EnemyFSM_AI/PathWalk.cs
Normal file
25
Assets/Scripts/Game/Component/EnemyFSM_AI/PathWalk.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f98a710f96914e2e8585939e12bff6d8
|
||||
timeCreated: 1729096274
|
||||
@@ -4,6 +4,10 @@ namespace Game.Component.EnemyFSM_AI
|
||||
{
|
||||
public class Sleep : EnemyFSMState
|
||||
{
|
||||
|
||||
public override void OnEnter ()
|
||||
{
|
||||
SetAiTarget (this.Entity.CreatePos);
|
||||
//此处可设置角色动画为沉睡状态
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user