diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx index 2a2202a..57a1830 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/Sound.xlsx b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx index 0ace668..4da2ebc 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 d977df6..623f344 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/Weapon.json b/DungeonShooting_Godot/resource/config/Weapon.json index 62e82f2..990757d 100644 --- a/DungeonShooting_Godot/resource/config/Weapon.json +++ b/DungeonShooting_Godot/resource/config/Weapon.json @@ -37,6 +37,7 @@ "ScatteringRangeAddValue": 3, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.5, + "CameraShake": 2, "BacklashRange": [ 2, 4 @@ -49,6 +50,9 @@ "HarmRange": [ 4 ], + "RepelRnage": [ + 20 + ], "BulletDeviationAngleRange": [ 0 ], @@ -123,6 +127,7 @@ "ScatteringRangeAddValue": 3, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.5, + "CameraShake": 2, "BacklashRange": [ 2, 4 @@ -135,6 +140,9 @@ "HarmRange": [ 4 ], + "RepelRnage": [ + 20 + ], "BulletDeviationAngleRange": [ 0 ], @@ -209,6 +217,7 @@ "ScatteringRangeAddValue": 20, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.5, + "CameraShake": 4, "BacklashRange": [ 5, 6 @@ -221,6 +230,9 @@ "HarmRange": [ 4 ], + "RepelRnage": [ + 30 + ], "BulletDeviationAngleRange": [ -10, 10 @@ -296,6 +308,7 @@ "ScatteringRangeAddValue": 20, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.5, + "CameraShake": 4, "BacklashRange": [ 5, 6 @@ -308,6 +321,9 @@ "HarmRange": [ 4 ], + "RepelRnage": [ + 30 + ], "BulletDeviationAngleRange": [ -10, 10 @@ -383,6 +399,7 @@ "ScatteringRangeAddValue": 4, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.5, + "CameraShake": 4, "BacklashRange": [ 3, 5 @@ -395,6 +412,9 @@ "HarmRange": [ 4 ], + "RepelRnage": [ + 20 + ], "BulletDeviationAngleRange": [ 0 ], @@ -469,6 +489,7 @@ "ScatteringRangeAddValue": 4, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.5, + "CameraShake": 4, "BacklashRange": [ 3, 5 @@ -481,6 +502,9 @@ "HarmRange": [ 4 ], + "RepelRnage": [ + 20 + ], "BulletDeviationAngleRange": [ 0 ], @@ -555,6 +579,7 @@ "ScatteringRangeAddValue": 0, "ScatteringRangeBackSpeed": 0, "ScatteringRangeBackDelayTime": 0, + "CameraShake": 7, "BacklashRange": [ -8 ], @@ -566,6 +591,9 @@ "HarmRange": [ 25 ], + "RepelRnage": [ + 150 + ], "BulletDeviationAngleRange": [ 0 ], @@ -638,6 +666,7 @@ "ScatteringRangeAddValue": 0, "ScatteringRangeBackSpeed": 0, "ScatteringRangeBackDelayTime": 0, + "CameraShake": 7, "BacklashRange": [ -8 ], @@ -649,6 +678,9 @@ "HarmRange": [ 25 ], + "RepelRnage": [ + 150 + ], "BulletDeviationAngleRange": [ 0 ], @@ -721,6 +753,7 @@ "ScatteringRangeAddValue": 40, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.8, + "CameraShake": 5, "BacklashRange": [ 5, 7 @@ -733,6 +766,9 @@ "HarmRange": [ 30 ], + "RepelRnage": [ + 250 + ], "BulletDeviationAngleRange": [ 0 ], @@ -807,6 +843,7 @@ "ScatteringRangeAddValue": 40, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.8, + "CameraShake": 5, "BacklashRange": [ 5, 7 @@ -819,6 +856,9 @@ "HarmRange": [ 30 ], + "RepelRnage": [ + 250 + ], "BulletDeviationAngleRange": [ 0 ], @@ -893,6 +933,7 @@ "ScatteringRangeAddValue": 2, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.3, + "CameraShake": 2, "BacklashRange": [ 1, 2 @@ -905,6 +946,9 @@ "HarmRange": [ 3 ], + "RepelRnage": [ + 10 + ], "BulletDeviationAngleRange": [ 0 ], @@ -979,6 +1023,7 @@ "ScatteringRangeAddValue": 2, "ScatteringRangeBackSpeed": 30, "ScatteringRangeBackDelayTime": 0.3, + "CameraShake": 2, "BacklashRange": [ 1, 2 @@ -991,6 +1036,9 @@ "HarmRange": [ 3 ], + "RepelRnage": [ + 10 + ], "BulletDeviationAngleRange": [ 0 ], @@ -1065,6 +1113,7 @@ "ScatteringRangeAddValue": 3, "ScatteringRangeBackSpeed": 50, "ScatteringRangeBackDelayTime": 0.3, + "CameraShake": 2, "BacklashRange": [ 1, 2 @@ -1077,6 +1126,9 @@ "HarmRange": [ 3 ], + "RepelRnage": [ + 15 + ], "BulletDeviationAngleRange": [ 0 ], @@ -1151,6 +1203,7 @@ "ScatteringRangeAddValue": 3, "ScatteringRangeBackSpeed": 50, "ScatteringRangeBackDelayTime": 0.3, + "CameraShake": 2, "BacklashRange": [ 1, 2 @@ -1163,6 +1216,9 @@ "HarmRange": [ 3 ], + "RepelRnage": [ + 15 + ], "BulletDeviationAngleRange": [ 0 ], 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 7feefd0..74763d2 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":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":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 diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preview.png b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preview.png index b31f92e..3f0900c 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preview.png +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preview.png Binary files differ diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs b/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs index d83dda9..3ab51ab 100644 --- a/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs +++ b/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs @@ -211,6 +211,12 @@ public float ScatteringRangeBackDelayTime; /// + /// 开火后相机抖动强度,只有玩家拾起武器开火才会抖动相机 + /// + [JsonInclude] + public float CameraShake; + + /// /// 后坐力区间 (仅用于开火后武器身抖动)
/// 格式为[value]或者[min,max] ///
@@ -255,6 +261,13 @@ public int[] HarmRange; /// + /// 造成伤害后击退值区间,按每发子弹算击退
+ /// 格式为[value]或者[min,max] + ///
+ [JsonInclude] + public float[] RepelRnage; + + /// /// 子弹偏移角度区间
/// 用于设置子弹偏移朝向, 该属性和射半径效果类似, 但与其不同的是, 散射半径是用来控制枪口朝向的, 而该属性是控制子弹朝向的, 可用于制作霰弹枪子弹效果
/// 格式为[value]或者[min,max] @@ -430,6 +443,7 @@ inst.ScatteringRangeAddValue = ScatteringRangeAddValue; inst.ScatteringRangeBackSpeed = ScatteringRangeBackSpeed; inst.ScatteringRangeBackDelayTime = ScatteringRangeBackDelayTime; + inst.CameraShake = CameraShake; inst.BacklashRange = BacklashRange; inst.BacklashRegressionSpeed = BacklashRegressionSpeed; inst.UpliftAngle = UpliftAngle; @@ -437,6 +451,7 @@ inst.UpliftAngleRestore = UpliftAngleRestore; inst.BulletId = BulletId; inst.HarmRange = HarmRange; + inst.RepelRnage = RepelRnage; inst.BulletDeviationAngleRange = BulletDeviationAngleRange; inst.BulletSpeedRange = BulletSpeedRange; inst.BulletDistanceRange = BulletDistanceRange; diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs index fd0bd6d..764238a 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs @@ -709,7 +709,7 @@ MoveController.RemoveForce(_throwForce); } - _throwForce = new ExternalForce("throw"); + _throwForce = new ExternalForce(ForceNames.Throw); _throwForce.Velocity = velocity; MoveController.AddForce(_throwForce); diff --git a/DungeonShooting_Godot/src/game/activity/ForceNames.cs b/DungeonShooting_Godot/src/game/activity/ForceNames.cs new file mode 100644 index 0000000..ae60220 --- /dev/null +++ b/DungeonShooting_Godot/src/game/activity/ForceNames.cs @@ -0,0 +1,11 @@ + +/// +/// 特殊外力名称 +/// +public class ForceNames +{ + /// + /// 投抛外力 + /// + public const string Throw = "throw"; +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs b/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs index b57041b..b9a4824 100644 --- a/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs +++ b/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs @@ -40,6 +40,11 @@ /// 最大伤害 ///
public int MaxHarm { get; set; } = 4; + + /// + /// 发射该子弹的角色 + /// + public Role Trigger { get; private set; } // 最大飞行距离 private float MaxDistance; @@ -62,13 +67,13 @@ /// 攻击目标层级 public void Init(Role trigger, Weapon weapon, float speed, float maxDistance, Vector2 position, float rotation, uint targetLayer) { + Trigger = trigger; Weapon = weapon; Role = weapon.Master; AttackLayer = targetLayer; CollisionArea.AreaEntered += OnArea2dEntered; - //只有玩家使用该武器才能获得正常速度的子弹 - if (trigger != null && !trigger.IsAi) + if (trigger != null && !trigger.IsAi) //只有玩家使用该武器才能获得正常速度的子弹 { FlySpeed = speed; } @@ -143,7 +148,16 @@ { damage = Role.RoleState.CallCalcDamageEvent(damage); } + + //击退 + if (role is not Player) //目标不是玩家才会触发击退 + { + var attr = Trigger != null && !Trigger.IsAi ? Weapon.PlayerUseAttribute : Weapon.AiUseAttribute; + var repel = Utils.Random.RandomConfigRange(attr.RepelRnage); + role.MoveController.AddForce(Vector2.FromAngle(BasisVelocity.Angle()) * repel, repel * 2); + } + //造成伤害 role.CallDeferred(nameof(Role.Hurt), damage, Rotation); Destroy(); } diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs index abc4a4d..a5ec76c 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs @@ -17,6 +17,11 @@ /// Ai使用该武器的属性 /// public ExcelConfig.Weapon AiUseAttribute => _aiWeaponAttribute; + + /// + /// 玩家使用该武器的属性 + /// + public ExcelConfig.Weapon PlayerUseAttribute => _playerWeaponAttribute; private ExcelConfig.Weapon _weaponAttribute; private ExcelConfig.Weapon _playerWeaponAttribute; diff --git a/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs b/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs index 0dfeaeb..b8e288f 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs @@ -11,7 +11,7 @@ if (Master == Player.Current) { //创建抖动 - GameCamera.Main.DirectionalShake(Vector2.Right.Rotated(GlobalRotation) * 2f); + GameCamera.Main.DirectionalShake(Vector2.Right.Rotated(GlobalRotation) * Attribute.CameraShake); } //创建开火特效 diff --git a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs index f8d56f1..0f83144 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs @@ -100,12 +100,12 @@ if (Master.Face == FaceDirection.Right) { //GameCamera.Main.DirectionalShake(Vector2.FromAngle(Mathf.DegToRad(r - 90)) * 5); - GameCamera.Main.DirectionalShake(Vector2.FromAngle(Mathf.DegToRad(r - 180)) * 7); + GameCamera.Main.DirectionalShake(Vector2.FromAngle(Mathf.DegToRad(r - 180)) * Attribute.CameraShake); } else { //GameCamera.Main.DirectionalShake(Vector2.FromAngle(Mathf.DegToRad(270 - r)) * 5); - GameCamera.Main.DirectionalShake(Vector2.FromAngle(Mathf.DegToRad(-r)) * 7); + GameCamera.Main.DirectionalShake(Vector2.FromAngle(Mathf.DegToRad(-r)) * Attribute.CameraShake); } } } @@ -130,11 +130,18 @@ if (activityObject is Role role) //碰到角色 { var damage = Utils.Random.RandomConfigRange(Attribute.HarmRange); - if (Master != null) + damage = Master.RoleState.CallCalcDamageEvent(damage); + //击退 + if (role is not Player) //目标不是玩家才会触发击退 { - damage = Master.RoleState.CallCalcDamageEvent(damage); + var attr = Master.IsAi ? AiUseAttribute : PlayerUseAttribute; + var repel = Utils.Random.RandomConfigRange(attr.RepelRnage); + var position = role.GlobalPosition - Master.MountPoint.GlobalPosition; + var v2 = position.Normalized() * repel; + role.MoveController.AddForce(v2, repel * 2); } + //造成伤害 role.CallDeferred(nameof(Role.Hurt), damage, (role.GetCenterPosition() - GlobalPosition).Angle()); } else if (activityObject is Bullet bullet) //攻击子弹