diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx index 737ead8..52049a3 100644 --- a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/AiAttackAttr.xlsx b/DungeonShooting_Godot/excel/excelFile/AiAttackAttr.xlsx index 80efe6f..c091459 100644 --- a/DungeonShooting_Godot/excel/excelFile/AiAttackAttr.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/AiAttackAttr.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/Sound.xlsx b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx index 8aad412..3e266b2 100644 --- a/DungeonShooting_Godot/excel/excelFile/Sound.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx b/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx index 07cf38d..ee67233 100644 --- a/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx Binary files differ diff --git a/DungeonShooting_Godot/resource/config/AiAttackAttr.json b/DungeonShooting_Godot/resource/config/AiAttackAttr.json index 9505e7d..2188c73 100644 --- a/DungeonShooting_Godot/resource/config/AiAttackAttr.json +++ b/DungeonShooting_Godot/resource/config/AiAttackAttr.json @@ -3,7 +3,8 @@ "Id": "0001", "Remark": "", "FiringStand": true, - "LockingTime": 0.5, + "ShowSubline": false, + "LockingTime": 1, "BulletSpeedScale": 0.35, "AmmoConsumptionProbability": 0 }, @@ -11,6 +12,7 @@ "Id": "0002", "Remark": "", "FiringStand": true, + "ShowSubline": false, "LockingTime": 2, "BulletSpeedScale": 0.35, "AmmoConsumptionProbability": 0 @@ -19,22 +21,34 @@ "Id": "0003", "Remark": "", "FiringStand": true, + "ShowSubline": false, "LockingTime": 1, "BulletSpeedScale": 0.35, "AmmoConsumptionProbability": 0 }, { "Id": "0004", - "Remark": "", - "FiringStand": true, + "Remark": "\u79FB\u52A8\u5C04\u51FB", + "FiringStand": false, + "ShowSubline": false, "LockingTime": 0.7, "BulletSpeedScale": 0.35, "AmmoConsumptionProbability": 0 }, { "Id": "0005", + "Remark": "\u4F7F\u7528\u8FDC\u8DDD\u79BB\u6B66\u5668", + "FiringStand": true, + "ShowSubline": true, + "LockingTime": 1.5, + "BulletSpeedScale": 0.35, + "AmmoConsumptionProbability": 0 + }, + { + "Id": "0006", "Remark": "", "FiringStand": true, + "ShowSubline": false, "LockingTime": 1.5, "BulletSpeedScale": 0.35, "AmmoConsumptionProbability": 0 diff --git a/DungeonShooting_Godot/resource/config/Weapon.json b/DungeonShooting_Godot/resource/config/Weapon.json index 8bea3fb..11a4daf 100644 --- a/DungeonShooting_Godot/resource/config/Weapon.json +++ b/DungeonShooting_Godot/resource/config/Weapon.json @@ -1085,7 +1085,7 @@ "BeLoadedSoundDelayTime": 0, "__OtherSoundMap": null, "__AiUseAttribute": "", - "__AiAttackAttr": "0005" + "__AiAttackAttr": "0004" }, { "Id": "0013", @@ -1267,6 +1267,6 @@ "BeLoadedSoundDelayTime": 0, "__OtherSoundMap": null, "__AiUseAttribute": "", - "__AiAttackAttr": "0005" + "__AiAttackAttr": "0006" } ] \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preinstall.json index fd75129..582ee5f 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preinstall.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preinstall.json @@ -1 +1 @@ -[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":19,"Y":2},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":-76,"Y":35},"Size":{"X":0,"Y":0},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-79,"Y":46},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0002","Weight":100,"Attr":{"CurrAmmon":"7","ResidueAmmo":"70"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-75,"Y":2},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0004","Weight":100,"Attr":{"CurrAmmon":"180","ResidueAmmo":"90"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-75,"Y":67},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0005","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"40"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-73,"Y":-18},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0003","Weight":100,"Attr":{"CurrAmmon":"12","ResidueAmmo":"90"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-76,"Y":21},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0006","Weight":100,"Attr":{"CurrAmmon":"20","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-74,"Y":-30},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0007","Weight":100,"Attr":{"CurrAmmon":"60","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]}],[{"Position":{"X":55,"Y":67},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0003","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":56,"Y":24},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0.5,"MarkList":[{"Id":"prop5000","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":56,"Y":0},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1,"MarkList":[{"Id":"prop5001","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":34,"Y":23},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1.5,"MarkList":[{"Id":"prop0002","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":55,"Y":44},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop5001","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":56,"Y":-24},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop5001","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]}]]}] \ No newline at end of file +[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":19,"Y":2},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":-76,"Y":35},"Size":{"X":0,"Y":0},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-79,"Y":46},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0002","Weight":100,"Attr":{"CurrAmmon":"7","ResidueAmmo":"70"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-75,"Y":2},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0004","Weight":100,"Attr":{"CurrAmmon":"180","ResidueAmmo":"90"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-75,"Y":67},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0005","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"40"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-73,"Y":-18},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0003","Weight":100,"Attr":{"CurrAmmon":"12","ResidueAmmo":"90"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-76,"Y":21},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0006","Weight":100,"Attr":{"CurrAmmon":"20","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-74,"Y":-30},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0007","Weight":100,"Attr":{"CurrAmmon":"60","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]}],[{"Position":{"X":55,"Y":67},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0003","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":56,"Y":24},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0.5,"MarkList":[{"Id":"prop5000","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":56,"Y":0},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1,"MarkList":[{"Id":"prop5001","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":34,"Y":23},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1.5,"MarkList":[{"Id":"prop0002","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":55,"Y":44},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop5001","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":56,"Y":-24},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop5001","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-16,"Y":16},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0005","CurrAmmon":"10","ResidueAmmo":"10"},"Altitude":0,"VerticalSpeed":0}]}]]}] \ No newline at end of file diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_AiAttackAttr.cs b/DungeonShooting_Godot/src/config/ExcelConfig_AiAttackAttr.cs index 54483ea..660f4b9 100644 --- a/DungeonShooting_Godot/src/config/ExcelConfig_AiAttackAttr.cs +++ b/DungeonShooting_Godot/src/config/ExcelConfig_AiAttackAttr.cs @@ -26,6 +26,12 @@ public bool FiringStand; /// + /// 是否显示射击辅助线 + /// + [JsonInclude] + public bool ShowSubline; + + /// /// Ai属性
/// 目标锁定时间, 也就是瞄准目标多久才会开火, (单位: 秒) ///
@@ -55,6 +61,7 @@ inst.Id = Id; inst.Remark = Remark; inst.FiringStand = FiringStand; + inst.ShowSubline = ShowSubline; inst.LockingTime = LockingTime; inst.BulletSpeedScale = BulletSpeedScale; inst.AmmoConsumptionProbability = AmmoConsumptionProbability; diff --git a/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs b/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs index 37bbf3f..d12ee12 100644 --- a/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs +++ b/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs @@ -152,7 +152,7 @@ var weapon = WeaponPack.ActiveItem; if (weapon != null) { - if (!weapon.IsAttackIntervalTime()) //必须在可以开火时记录时间 + if (weapon.GetBeLoadedStateState() >= 2 && !weapon.IsAttackIntervalTime()) //必须在可以开火时记录时间 { _lockTargetTime += delta; } diff --git a/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiFollowUpState.cs b/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiFollowUpState.cs index be7c306..15c1933 100644 --- a/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiFollowUpState.cs +++ b/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiFollowUpState.cs @@ -75,7 +75,8 @@ if (!Master.NavigationAgent2D.IsNavigationFinished()) { - if (Master.AttackState != AiAttackState.LockingTime && Master.AttackState != AiAttackState.Attack) + if (weapon == null || !weapon.Attribute.AiAttackAttr.FiringStand || + (Master.AttackState != AiAttackState.LockingTime && Master.AttackState != AiAttackState.Attack)) { //计算移动 var nextPos = Master.NavigationAgent2D.GetNextPathPosition(); diff --git a/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiSurroundState.cs b/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiSurroundState.cs index ec11954..6d48ee4 100644 --- a/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiSurroundState.cs +++ b/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiSurroundState.cs @@ -71,7 +71,10 @@ } //在视野中, 或者锁敌状态下, 或者攻击状态下, 继续保持原本逻辑 - if (IsInView || Master.AttackState == AiAttackState.LockingTime || Master.AttackState == AiAttackState.Attack) + if (IsInView || + (weapon != null && weapon.Attribute.AiAttackAttr.FiringStand && + (Master.AttackState == AiAttackState.LockingTime || Master.AttackState == AiAttackState.Attack) + )) { if (_pauseTimer >= 0) { @@ -102,11 +105,11 @@ { _moveFlag = true; //计算移动 - var pos = Master.GlobalPosition; var nextPos = Master.NavigationAgent2D.GetNextPathPosition(); Master.AnimatedSprite.Play(AnimatorNames.Run); - Master.BasisVelocity = (nextPos - Master.GlobalPosition - Master.NavigationPoint.Position).Normalized() * - Master.RoleState.MoveSpeed; + Master.BasisVelocity = + (nextPos - Master.GlobalPosition - Master.NavigationPoint.Position).Normalized() * + Master.RoleState.MoveSpeed; } else { @@ -121,7 +124,8 @@ } else { - if (Master.AttackState != AiAttackState.LockingTime && Master.AttackState != AiAttackState.Attack) + if (weapon == null || !weapon.Attribute.AiAttackAttr.FiringStand || + (Master.AttackState != AiAttackState.LockingTime && Master.AttackState != AiAttackState.Attack)) { //计算移动 var nextPos = Master.NavigationAgent2D.GetNextPathPosition(); @@ -135,7 +139,7 @@ Master.BasisVelocity = Vector2.Zero; } } - + if (_prevPos.DistanceSquaredTo(pos) <= 0.01f) { _lockTimer += delta; diff --git a/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiTailAfterState.cs b/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiTailAfterState.cs index 6b04b6a..87b21aa 100644 --- a/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiTailAfterState.cs +++ b/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiTailAfterState.cs @@ -63,7 +63,9 @@ if (!Master.NavigationAgent2D.IsNavigationFinished()) { - if (Master.AttackState != AiAttackState.LockingTime && Master.AttackState != AiAttackState.Attack) + var weapon = Master.WeaponPack.ActiveItem; + if (weapon == null || !weapon.Attribute.AiAttackAttr.FiringStand || + (Master.AttackState != AiAttackState.LockingTime && Master.AttackState != AiAttackState.Attack)) { //计算移动 var nextPos = Master.NavigationAgent2D.GetNextPathPosition(); diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs index 94a9203..3938cd9 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs @@ -214,7 +214,7 @@ private float _reloadTimer = 0; //单独换弹设置下的换弹状态, 0: 未换弹, 1: 装第一颗子弹之前, 2: 单独装弹中, 3: 单独装弹完成 - private byte _aloneReloadState = 0; + private byte _aloneReloadState = 3; //单独换弹状态下是否强制结束换弹过程 private bool _aloneReloadStop = false; @@ -465,7 +465,7 @@ if (_dirtyFlag) { _dirtyFlag = false; - _aloneReloadState = 0; + //_aloneReloadState = 0; StopReload(); _attackFlag = false; _continuousCount = 0; @@ -883,6 +883,14 @@ { return _attackTimer > 0 || _triggerTimer > 0; } + + /// + /// 获取上膛状态,-1: 等待执行自动上膛 , 0: 未上膛, 1: 上膛中, 2: 已经完成上膛 + /// + public sbyte GetBeLoadedStateState() + { + return _beLoadedState; + } /// /// 刚按下扳机 @@ -1932,6 +1940,14 @@ { flag = AiAttackState.Reloading; } + else if (_beLoadedState == 0 || _beLoadedState == -1) //需要上膛 + { + flag = AiAttackState.AttackInterval; + } + else if (_beLoadedState == 1) //上膛中 + { + flag = AiAttackState.AttackInterval; + } else if (_continuousCount >= 1) //连发中 { flag = AiAttackState.Attack; @@ -1999,6 +2015,15 @@ flag = AiAttackState.Reloading; Reload(); } + else if (_beLoadedState == 0 || _beLoadedState == -1) //需要上膛 + { + flag = AiAttackState.AttackInterval; + Master.Attack(); + } + else if (_beLoadedState == 1) //上膛中 + { + flag = AiAttackState.AttackInterval; + } else if (_continuousCount >= 1) //连发中 { flag = AiAttackState.Attack; @@ -2049,6 +2074,7 @@ } } + Debug.Log("state: " + flag); return flag; } diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs index a8ab6dc..822e63e 100644 --- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs +++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs @@ -202,7 +202,7 @@ World = GameApplication.Instance.CreateNewWorld(); yield return 0; //生成地牢房间 - var random = new SeedRandom(1); + var random = new SeedRandom(); _dungeonGenerator = new DungeonGenerator(CurrConfig, random); _dungeonGenerator.Generate(); yield return 0;