diff --git a/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json b/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json index ce8105f..d9e69c2 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json @@ -19,6 +19,10 @@ { "ErrorType": 0, "Path": "resource/map/tileMaps/TestGroup1/inlet/Start1" + }, + { + "ErrorType": 0, + "Path": "resource/map/tileMaps/TestGroup1/inlet/Start2" } ], "OutletList": [ 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 74763d2..30d1488 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":10,"Y":22},"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":0,"Y":16},"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":23,"Y":-24},"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":-35,"Y":59},"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":11,"Y":38},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0003","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-15,"Y":31},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0.5,"MarkList":[{"Id":"prop5000","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":36,"Y":36},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1,"MarkList":[{"Id":"prop5001","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":35,"Y":2},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1.5,"MarkList":[{"Id":"prop0002","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-12,"Y":3},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":2,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-36,"Y":-18},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop5000","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":-38,"Y":41},"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":-38,"Y":55},"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":-38,"Y":11},"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":-39,"Y":69},"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":-38,"Y":-8},"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":-38,"Y":27},"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":-38,"Y":-28},"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 diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start2/Preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start2/Preinstall.json new file mode 100644 index 0000000..2af15f7 --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start2/Preinstall.json @@ -0,0 +1 @@ +[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":0,"Y":0},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":0,"Y":26},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0005","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"40"},"Altitude":8,"VerticalSpeed":0}]}]]}] \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start2/Preview.png b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start2/Preview.png new file mode 100644 index 0000000..dbbb1d3 --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start2/Preview.png Binary files differ diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start2/Preview.png.import b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start2/Preview.png.import new file mode 100644 index 0000000..68d306b --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start2/Preview.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cr5tlhxfjetuf" +path="res://.godot/imported/Preview.png-8fbf34b154290497f5a1f19b421f568c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/map/tileMaps/TestGroup1/inlet/Start2/Preview.png" +dest_files=["res://.godot/imported/Preview.png-8fbf34b154290497f5a1f19b421f568c.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start2/RoomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start2/RoomInfo.json new file mode 100644 index 0000000..27eaead --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start2/RoomInfo.json @@ -0,0 +1 @@ +{"Position":{"X":-5,"Y":-5},"Size":{"X":10,"Y":12},"DoorAreaInfos":[{"Direction":3,"Start":0,"End":128},{"Direction":0,"Start":0,"End":160},{"Direction":1,"Start":0,"End":160}],"GroupName":"TestGroup1","RoomType":1,"RoomName":"Start2","Weight":100,"Remark":""} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start2/TileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start2/TileInfo.json new file mode 100644 index 0000000..8ba5c2f --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start2/TileInfo.json @@ -0,0 +1 @@ +{"NavigationList":[{"Type":0,"Points":[-56,-56,56,-56,56,96,40,96,40,48,-40,48,-40,96,-56,96]}],"Floor":[3,5,0,0,8,3,4,0,0,8,3,3,0,0,8,3,2,0,0,8,3,1,0,0,8,3,0,0,0,8,3,-1,0,0,8,3,-2,0,0,8,3,-3,0,0,8,3,-4,0,0,8,-4,5,0,0,8,-4,4,0,0,8,-4,3,0,0,8,-4,2,0,0,8,-4,1,0,0,8,-4,0,0,0,8,-4,-1,0,0,8,-4,-2,0,0,8,-4,-3,0,0,8,-4,-4,0,0,8,2,5,0,0,8,2,4,0,0,8,2,3,0,0,8,2,2,0,0,8,2,0,0,0,8,2,-1,0,0,8,2,-2,0,0,8,2,-3,0,0,8,2,-4,0,0,8,2,1,0,0,8,1,2,0,0,8,1,0,0,0,8,1,-1,0,0,8,1,-2,0,0,8,1,-3,0,0,8,1,-4,0,0,8,1,1,0,0,8,0,2,0,0,8,0,1,0,0,8,0,-1,0,0,8,0,-2,0,0,8,0,-3,0,0,8,0,-4,0,0,8,0,0,0,0,8,-1,2,0,0,8,-1,1,0,0,8,-1,0,0,0,8,-1,-2,0,0,8,-1,-3,0,0,8,-1,-4,0,0,8,-1,-1,0,0,8,-2,2,0,0,8,-2,1,0,0,8,-2,0,0,0,8,-2,-1,0,0,8,-2,-3,0,0,8,-2,-4,0,0,8,-2,-2,0,0,8,-3,5,0,0,8,-3,4,0,0,8,-3,3,0,0,8,-3,2,0,0,8,-3,1,0,0,8,-3,0,0,0,8,-3,-1,0,0,8,-3,-2,0,0,8,-3,-3,0,0,8,-3,-4,0,0,8],"Middle":[-4,-5,0,2,7,-3,-5,0,2,7,-2,-5,0,2,7,-1,-5,0,2,7,0,-5,0,2,7,1,-5,0,2,7,2,-5,0,2,7,3,-5,0,2,7],"Top":[-5,-5,0,3,4,-5,-4,0,3,3,-5,-3,0,3,3,-5,-2,0,3,3,-5,-1,0,3,3,-5,0,0,3,3,-5,1,0,3,3,-5,2,0,3,3,-5,3,0,3,3,-5,4,0,3,3,-5,5,0,3,3,-5,6,0,11,2,-4,6,0,2,2,-3,6,0,2,2,-2,3,0,1,2,-2,4,0,1,3,-2,5,0,1,3,-2,6,0,13,2,-1,3,0,2,2,0,3,0,2,2,1,3,0,3,2,1,4,0,3,3,1,5,0,3,3,1,6,0,11,2,2,6,0,2,2,3,6,0,2,2,4,-5,0,1,4,4,-4,0,1,3,4,-3,0,1,3,4,-2,0,1,3,4,-1,0,1,3,4,0,0,1,3,4,1,0,1,3,4,2,0,1,3,4,3,0,1,3,4,4,0,1,3,4,5,0,1,3,4,6,0,13,2]} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs index 23afa6b..8ddb33f 100644 --- a/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs +++ b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs @@ -287,7 +287,6 @@ /// /// 移除指定索引的 Cell /// - /// public void RemoveByIndex(int index) { if (index < 0 || index >= _cellList.Count) diff --git a/DungeonShooting_Godot/src/game/GameApplication.cs b/DungeonShooting_Godot/src/game/GameApplication.cs index 1275dd1..01d2434 100644 --- a/DungeonShooting_Godot/src/game/GameApplication.cs +++ b/DungeonShooting_Godot/src/game/GameApplication.cs @@ -36,7 +36,7 @@ /// 是否开启调试 /// [ExportGroup("Debug")] - [Export] public bool Debug = false; + [Export] public bool Debug; /// /// 鼠标指针 diff --git a/DungeonShooting_Godot/src/game/activity/role/player/Player.cs b/DungeonShooting_Godot/src/game/activity/role/player/Player.cs index 1696169..419db5c 100644 --- a/DungeonShooting_Godot/src/game/activity/role/player/Player.cs +++ b/DungeonShooting_Godot/src/game/activity/role/player/Player.cs @@ -308,4 +308,10 @@ BasisVelocity = new Vector2(BasisVelocity.X, Mathf.MoveToward(BasisVelocity.Y, dir.Y * RoleState.MoveSpeed, RoleState.Acceleration * delta)); } } + + protected override void DebugDraw() + { + base.DebugDraw(); + DrawArc(new Vector2(0, -8), 50, 0, Mathf.Pi * 2f, 20, Colors.Red, 1); + } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs index 34ca189..c6b93e7 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs @@ -433,7 +433,8 @@ _noAttackTime += delta; //这把武器被扔在地上, 或者当前武器没有被使用 - if (Master == null || Master.WeaponPack.ActiveItem != this) + //if (Master == null || Master.WeaponPack.ActiveItem != this) + if (Master != null && Master.WeaponPack.ActiveItem != this) //在背上 { //_triggerTimer _triggerTimer = _triggerTimer > 0 ? _triggerTimer - delta : 0; @@ -455,9 +456,7 @@ { _dirtyFlag = false; _aloneReloadState = 0; - Reloading = false; - _reloadTimer = 0; - _reloadUseTime = 0; + StopReload(); _attackFlag = false; _continuousCount = 0; _delayedTime = 0; @@ -520,7 +519,7 @@ if (Attribute.AloneReloadFinishIntervalTime <= 0) { //换弹完成 - StopReloadState(); + StopReload(); ReloadFinishHandler(); } else @@ -545,7 +544,7 @@ if (_reloadTimer <= 0) { //换弹完成 - StopReloadState(); + StopReload(); ReloadFinishHandler(); } _aloneReloadStop = false; @@ -579,7 +578,11 @@ _delayedTime += _attackTimer; _attackTimer = 0; //枪口默认角度 - RotationDegrees = -Attribute.DefaultAngle; + if (Master != null) + { + RotationDegrees = -Attribute.DefaultAngle; + } + //自动上膛 if (_beLoadedState == -1) { @@ -625,7 +628,7 @@ if (!_looseShootFlag && _continuousCount > 0 && _delayedTime <= 0 && _attackTimer <= 0) { //连发开火 - TriggerFire(_attackTrigger); + TriggerFire(); //连发最后一发打完了 if (Attribute.ManualBeLoaded && _continuousCount <= 0) { @@ -647,13 +650,16 @@ //武器身回归 //Position = Position.MoveToward(Vector2.Zero, Attribute.BacklashRegressionSpeed * delta).Rotated(Rotation); _currBacklashLength = Mathf.MoveToward(_currBacklashLength, 0, Attribute.BacklashRegressionSpeed * delta); - Position = new Vector2(_currBacklashLength, 0).Rotated(Rotation); - if (_attackTimer > 0) + if (Master != null) { - RotationDegrees = Mathf.Lerp( - _fireAngle, -Attribute.DefaultAngle, - Mathf.Clamp((_fireInterval - _attackTimer) * Attribute.UpliftAngleRestore / _fireInterval, 0, 1) - ); + Position = new Vector2(_currBacklashLength, 0).Rotated(Rotation); + if (_attackTimer > 0) + { + RotationDegrees = Mathf.Lerp( + _fireAngle, -Attribute.DefaultAngle, + Mathf.Clamp((_fireInterval - _attackTimer) * Attribute.UpliftAngleRestore / _fireInterval, 0, 1) + ); + } } } } @@ -687,7 +693,7 @@ if (_beLoadedState == 0 || _beLoadedState == -1) //需要执行上膛操作 { - if (justDown && !Reloading && Master != null) + if (justDown && !Reloading && trigger != null) { if (CurrAmmo <= 0) { @@ -757,7 +763,7 @@ else if (CurrAmmo <= 0) //子弹不够 { fireFlag = false; - if (justDown && Master != null) + if (justDown && trigger != null) { //第一帧按下, 触发换弹 Reload(); @@ -792,7 +798,7 @@ else { //开火 - TriggerFire(_attackTrigger); + TriggerFire(); //非连射模式 if (!Attribute.ContinuousShoot && Attribute.ManualBeLoaded && _continuousCount <= 0) @@ -868,7 +874,7 @@ _looseShootFlag = false; if (_chargeTime >= Attribute.MinChargeTime) //判断蓄力是否够了 { - TriggerFire(_attackTrigger); + TriggerFire(); //非连射模式 if (!Attribute.ContinuousShoot && Attribute.ManualBeLoaded && _continuousCount <= 0) { @@ -889,7 +895,7 @@ /// /// 触发开火 /// - private void TriggerFire(Role trigger) + private void TriggerFire() { _noAttackTime = 0; @@ -993,6 +999,18 @@ externalForce.RotationSpeed = -Mathf.DegToRad(40); externalForce.RotationResistance = Mathf.DegToRad(80); } + + if (IsInGround()) + { + //在地上弹药打光 + if (IsTotalAmmoEmpty()) + { + //停止动画 + AnimationPlayer.Stop(); + //清除泛白效果 + SetBlendSchedule(0); + } + } } /// @@ -1135,6 +1153,17 @@ } } + /// + /// 强制停止换弹, 或者结束换弹状态 + /// + public void StopReload() + { + _aloneReloadState = 0; + Reloading = false; + _reloadTimer = 0; + _reloadUseTime = 0; + } + //播放换弹开始音效 private void PlayBeginReloadSound() { @@ -1391,15 +1420,6 @@ } } - //停止当前的换弹状态 - private void StopReloadState() - { - _aloneReloadState = 0; - Reloading = false; - _reloadTimer = 0; - _reloadUseTime = 0; - } - /// /// 换弹计时器时间到, 执行换弹操作 /// @@ -1454,7 +1474,7 @@ ResidueAmmo = 0; } - StopReloadState(); + StopReload(); ReloadFinishHandler(); } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs index e4906be..41ed879 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs @@ -462,11 +462,11 @@ S_DynamicTool.Reparent(this); S_DynamicTool.Instance.Visible = false; var markCellIndex = markCell.Index; - var markInfo = waveCell.Data[markCellIndex]; + var markInfo = waveCell.MarkGrid.GetData(markCellIndex).MarkInfo; //派发移除标记事件 EventManager.EmitEvent(EventEnum.OnDeleteMark, markInfo); waveCell.MarkGrid.RemoveByIndex(markCellIndex); - waveCell.Data.RemoveAt(markCellIndex); + waveCell.Data.Remove(markInfo); //派发数据修改事件 EventManager.EmitEvent(EventEnum.OnEditorDirty); }