From 1ffb286c42370265366ccbe22339d3aaf09b6164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=9D=8Exl?= <1911159016@qq.com> Date: Tue, 9 Apr 2024 00:56:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B7=B2=E7=BB=8F=E5=8F=91?= =?UTF-8?q?=E7=8E=B0=E7=9A=84ai=E6=94=B9=E5=8F=98=E9=98=B5=E8=90=A5?= =?UTF-8?q?=E4=BC=9A=E6=8A=A5=E9=94=99=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Test1/inlet/Start2/Preinstall.json | 2 +- .../tileMaps/Test1/inlet/Start2/Preview.png | Bin 2098 -> 2094 bytes .../tileMaps/Test1/inlet/Start2/RoomInfo.json | 2 +- .../tileMaps/Test1/inlet/Start2/TileInfo.json | 2 +- .../src/game/GameApplication.cs | 2 +- .../role/ai/state/AiAstonishedState.cs | 36 +++++++++++------- .../activity/role/ai/state/AiAttackState.cs | 4 +- .../activity/role/ai/state/AiFollowUpState.cs | 4 +- .../activity/role/ai/state/AiNotifyState.cs | 4 +- .../activity/role/ai/state/AiSurroundState.cs | 4 +- .../role/ai/state/AiTailAfterState.cs | 4 +- 11 files changed, 41 insertions(+), 23 deletions(-) diff --git a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start2/Preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start2/Preinstall.json index 553b233b..e0cc3386 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start2/Preinstall.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start2/Preinstall.json @@ -1 +1 @@ -[{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":true,"WaveList":[[{"Position":{"X":0,"Y":0},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":53,"Y":31},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0003","CurrAmmon":"12","ResidueAmmo":"12"},"Altitude":0,"VerticalSpeed":5.551115E-14}]},{"Position":{"X":84,"Y":8},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0002","CurrAmmon":"7","ResidueAmmo":"7"},"Altitude":0,"VerticalSpeed":5.551115E-14}]}]]}] \ No newline at end of file +[{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":true,"WaveList":[[{"Position":{"X":-81,"Y":25},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":53,"Y":31},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0003","CurrAmmon":"12","ResidueAmmo":"12"},"Altitude":0,"VerticalSpeed":5.551115E-14}]},{"Position":{"X":84,"Y":8},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0002","CurrAmmon":"7","ResidueAmmo":"7"},"Altitude":0,"VerticalSpeed":5.551115E-14}]},{"Position":{"X":-54,"Y":20},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":5.551115E-14}]}]]}] \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start2/Preview.png b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start2/Preview.png index 556c95cc6917b35c2d27d8ae58a4ddf294554853..a1a56f6347b646cedfb67b98f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=qDfVzTm^uMZ!|@iz$V3Pm*YLXQE=a zG#Sl1*;`mQB}I-EXfgth1&zblJ5t~b+BUN6KScwY6as!lUaMAjRIf{NR?%fa?oy6M4*c=Z2S!#K9t>Ba7}n<23h{cQ#e zTn($#Jo5plF}s5kk`JT?vof`%W-*eV4W>%*q)bsEI7fPb0dS>w%l`DwAb~-f{qd~e zWTVwKEvRx(5ga!Lj(#QEF}@RGo^bM_m8+BG1_bpV=-!*Z z+<6;I6LeAbW(X?t28Sv*Pu{!0_Z#g-9k->ScHYqE+58JvyrF3r{ public class AiAstonishedState : StateBase { - /// - /// 下一个状态 - /// - public AIStateEnum NextState; - private float _timer; private object[] _args; + //用于判断是否进入过惊讶状态 + private bool _flag = false; public AiAstonishedState() : base(AIStateEnum.AiAstonished) { @@ -28,9 +25,15 @@ public class AiAstonishedState : StateBase return; } + if (_flag) + { + ChangeNextState(args); + return; + } + + _flag = true; _args = args; - NextState = (AIStateEnum)args[0]; _timer = 0.6f; //播放惊讶表情 @@ -46,14 +49,19 @@ public class AiAstonishedState : StateBase _timer -= delta; if (_timer <= 0) { - if (_args.Length == 1) - { - ChangeState(NextState); - } - else if (_args.Length == 2) - { - ChangeState(NextState, _args[1]); - } + ChangeNextState(_args); + } + } + + private void ChangeNextState(object[] args) + { + if (args.Length == 1) + { + ChangeState((AIStateEnum)args[0]); + } + else if (args.Length == 2) + { + ChangeState((AIStateEnum)args[0], args[1]); } } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/role/ai/state/AiAttackState.cs b/DungeonShooting_Godot/src/game/activity/role/ai/state/AiAttackState.cs index 8fcb08d3..417a0397 100644 --- a/DungeonShooting_Godot/src/game/activity/role/ai/state/AiAttackState.cs +++ b/DungeonShooting_Godot/src/game/activity/role/ai/state/AiAttackState.cs @@ -43,7 +43,9 @@ public class AiAttackState : StateBase { if (Master.LookTarget == null) { - throw new Exception("进入 AIAdvancedStateEnum.AiAttack 状态时角色没有攻击目标!"); + ChangeState(AIStateEnum.AiNormal); + return; + //throw new Exception("进入 AIAdvancedStateEnum.AiAttack 状态时角色没有攻击目标!"); } var weapon = Master.WeaponPack.ActiveItem; diff --git a/DungeonShooting_Godot/src/game/activity/role/ai/state/AiFollowUpState.cs b/DungeonShooting_Godot/src/game/activity/role/ai/state/AiFollowUpState.cs index c231a9af..679ed22b 100644 --- a/DungeonShooting_Godot/src/game/activity/role/ai/state/AiFollowUpState.cs +++ b/DungeonShooting_Godot/src/game/activity/role/ai/state/AiFollowUpState.cs @@ -21,7 +21,9 @@ public class AiFollowUpState : StateBase { if (Master.LookTarget == null) { - throw new Exception("进入 AIAdvancedStateEnum.AiFollowUp 状态时角色没有攻击目标!"); + ChangeState(AIStateEnum.AiNormal); + return; + //throw new Exception("进入 AIAdvancedStateEnum.AiFollowUp 状态时角色没有攻击目标!"); } _navigationUpdateTimer = 0; diff --git a/DungeonShooting_Godot/src/game/activity/role/ai/state/AiNotifyState.cs b/DungeonShooting_Godot/src/game/activity/role/ai/state/AiNotifyState.cs index b1e0b3f1..fac6cc87 100644 --- a/DungeonShooting_Godot/src/game/activity/role/ai/state/AiNotifyState.cs +++ b/DungeonShooting_Godot/src/game/activity/role/ai/state/AiNotifyState.cs @@ -17,7 +17,9 @@ public class AiNotifyState : StateBase { if (Master.LookTarget == null) { - throw new Exception("进入 AIAdvancedStateEnum.AiNotify 没有攻击目标!"); + ChangeState(AIStateEnum.AiNormal); + return; + //throw new Exception("进入 AIAdvancedStateEnum.AiNotify 没有攻击目标!"); } _timer = 1.2f; //通知其它角色 diff --git a/DungeonShooting_Godot/src/game/activity/role/ai/state/AiSurroundState.cs b/DungeonShooting_Godot/src/game/activity/role/ai/state/AiSurroundState.cs index 46497e13..47608369 100644 --- a/DungeonShooting_Godot/src/game/activity/role/ai/state/AiSurroundState.cs +++ b/DungeonShooting_Godot/src/game/activity/role/ai/state/AiSurroundState.cs @@ -32,7 +32,9 @@ public class AiSurroundState : StateBase { if (Master.LookTarget == null) { - throw new Exception("进入 AIAdvancedStateEnum.AiSurround 状态时角色没有攻击目标!"); + ChangeState(AIStateEnum.AiNormal); + return; + //throw new Exception("进入 AIAdvancedStateEnum.AiSurround 状态时角色没有攻击目标!"); } Master.TargetInView = true; diff --git a/DungeonShooting_Godot/src/game/activity/role/ai/state/AiTailAfterState.cs b/DungeonShooting_Godot/src/game/activity/role/ai/state/AiTailAfterState.cs index 05a5d9e7..b59e8492 100644 --- a/DungeonShooting_Godot/src/game/activity/role/ai/state/AiTailAfterState.cs +++ b/DungeonShooting_Godot/src/game/activity/role/ai/state/AiTailAfterState.cs @@ -29,7 +29,9 @@ public class AiTailAfterState : StateBase { if (Master.LookTarget == null) { - throw new Exception("进入 AIAdvancedStateEnum.AiTailAfter 状态时角色没有攻击目标!"); + ChangeState(AIStateEnum.AiNormal); + return; + //throw new Exception("进入 AIAdvancedStateEnum.AiTailAfter 状态时角色没有攻击目标!"); } _isInViewRange = true;