diff --git a/DungeonShooting_Godot/src/game/activity/role/ai/AIStateEnum.cs b/DungeonShooting_Godot/src/game/activity/role/ai/AIStateEnum.cs new file mode 100644 index 0000000..9b923d5 --- /dev/null +++ b/DungeonShooting_Godot/src/game/activity/role/ai/AIStateEnum.cs @@ -0,0 +1,40 @@ + +public enum AIStateEnum +{ + /// + /// Ai 状态, 正常, 未发现目标 + /// + AiNormal, + /// + /// 找到玩家,准备通知其他敌人 + /// + AiNotify, + /// + /// 惊讶状态 + /// + AiAstonished, + /// + /// 收到其他敌人通知, 前往发现目标的位置 + /// + AiLeaveFor, + /// + /// 发现目标, 目标不在视野内, 但是知道位置 + /// + AiTailAfter, + /// + /// 目标在视野内, 跟进目标, 如果距离在子弹有效射程内, 则开火 + /// + AiFollowUp, + /// + /// 距离足够近, 在目标附近随机移动 + /// + AiSurround, + /// + /// Ai 寻找弹药 + /// + AiFindAmmo, + /// + /// Ai攻击 + /// + AiAttack, +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/role/ai/AiRole.cs b/DungeonShooting_Godot/src/game/activity/role/ai/AiRole.cs index 2eba496..0ae1c61 100644 --- a/DungeonShooting_Godot/src/game/activity/role/ai/AiRole.cs +++ b/DungeonShooting_Godot/src/game/activity/role/ai/AiRole.cs @@ -80,6 +80,11 @@ /// 当前Ai是否有攻击欲望 /// public bool HasAttackDesire { get; private set; } = true; + + /// + /// 是否有移动欲望, 仅在 AiNormal 状态下有效, 其他状态都可以移动 + /// + public bool HasMoveDesire { get; private set; } = true; public override void OnInit() { @@ -405,6 +410,14 @@ } } + /// + /// 设置Ai是否有移动欲望 + /// + public void SetMoveDesire(bool v) + { + HasMoveDesire = v; + } + // private void OnVelocityComputed(Vector2 velocity) // { // if (Mathf.Abs(velocity.X) >= 0.01f && Mathf.Abs(velocity.Y) >= 0.01f) diff --git a/DungeonShooting_Godot/src/game/activity/role/ai/state/AiNormalState.cs b/DungeonShooting_Godot/src/game/activity/role/ai/state/AiNormalState.cs index dfdc704..c69ba6d 100644 --- a/DungeonShooting_Godot/src/game/activity/role/ai/state/AiNormalState.cs +++ b/DungeonShooting_Godot/src/game/activity/role/ai/state/AiNormalState.cs @@ -89,7 +89,7 @@ RunOver(); _isMoveOver = false; } - else //移动中 + else if (Master.HasMoveDesire) //移动中 { if (_lockTimer >= 1) //卡在一个点超过一秒 { diff --git a/DungeonShooting_Godot/src/game/activity/role/enemy/AIStateEnum.cs b/DungeonShooting_Godot/src/game/activity/role/enemy/AIStateEnum.cs deleted file mode 100644 index 9b923d5..0000000 --- a/DungeonShooting_Godot/src/game/activity/role/enemy/AIStateEnum.cs +++ /dev/null @@ -1,40 +0,0 @@ - -public enum AIStateEnum -{ - /// - /// Ai 状态, 正常, 未发现目标 - /// - AiNormal, - /// - /// 找到玩家,准备通知其他敌人 - /// - AiNotify, - /// - /// 惊讶状态 - /// - AiAstonished, - /// - /// 收到其他敌人通知, 前往发现目标的位置 - /// - AiLeaveFor, - /// - /// 发现目标, 目标不在视野内, 但是知道位置 - /// - AiTailAfter, - /// - /// 目标在视野内, 跟进目标, 如果距离在子弹有效射程内, 则开火 - /// - AiFollowUp, - /// - /// 距离足够近, 在目标附近随机移动 - /// - AiSurround, - /// - /// Ai 寻找弹药 - /// - AiFindAmmo, - /// - /// Ai攻击 - /// - AiAttack, -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/role/shop/ShopBoss.cs b/DungeonShooting_Godot/src/game/activity/role/shop/ShopBoss.cs index f481376..02360d5 100644 --- a/DungeonShooting_Godot/src/game/activity/role/shop/ShopBoss.cs +++ b/DungeonShooting_Godot/src/game/activity/role/shop/ShopBoss.cs @@ -10,7 +10,8 @@ public override void OnInit() { base.OnInit(); - SetAttackDesire(false); + SetAttackDesire(false); //默认不攻击 + SetMoveDesire(false); //默认不攻击 } protected override RoleState OnCreateRoleState()