diff --git a/DungeonShooting_Godot/DungeonShooting.sln.DotSettings.user b/DungeonShooting_Godot/DungeonShooting.sln.DotSettings.user index 639eefb..43de714 100644 --- a/DungeonShooting_Godot/DungeonShooting.sln.DotSettings.user +++ b/DungeonShooting_Godot/DungeonShooting.sln.DotSettings.user @@ -2,4 +2,7 @@ WARNING On On - On \ No newline at end of file + On + <SessionState ContinuousTestingMode="0" IsActive="True" Name="解决方案中的所有测试" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> + <Solution /> +</SessionState> \ No newline at end of file diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityBase.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityBase.xlsx index 6866ddc..3237a19 100644 --- a/DungeonShooting_Godot/excel/excelFile/ActivityBase.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/ActivityBase.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityMaterial.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityMaterial.xlsx index 00d3ca4..6dfb2a3 100644 --- a/DungeonShooting_Godot/excel/excelFile/ActivityMaterial.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/ActivityMaterial.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/AiAttackAttr.xlsx b/DungeonShooting_Godot/excel/excelFile/AiAttackAttr.xlsx index 76b7a0f..6652550 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/BulletBase.xlsx b/DungeonShooting_Godot/excel/excelFile/BulletBase.xlsx index 6bdc2c7..4dc62af 100644 --- a/DungeonShooting_Godot/excel/excelFile/BulletBase.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/BulletBase.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/Sound.xlsx b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx index fe89f6b..3db3a42 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/WeaponBase.xlsx b/DungeonShooting_Godot/excel/excelFile/WeaponBase.xlsx index 1c04d62..44a0031 100644 --- a/DungeonShooting_Godot/excel/excelFile/WeaponBase.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/WeaponBase.xlsx Binary files differ diff --git a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0001.tscn b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0001.tscn index 740c1cd..d372636 100644 --- a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0001.tscn +++ b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0001.tscn @@ -40,10 +40,11 @@ [sub_resource type="RectangleShape2D" id="RectangleShape2D_lcqb8"] size = Vector2(9, 4) -[node name="Bullet0001" type="CharacterBody2D" node_paths=PackedStringArray("CollisionArea", "ShadowSprite", "AnimatedSprite", "Collision")] +[node name="Bullet0001" type="CharacterBody2D" node_paths=PackedStringArray("CollisionArea", "CollisionShape2D", "ShadowSprite", "AnimatedSprite", "Collision")] collision_layer = 2 script = ExtResource("1_3d3df") CollisionArea = NodePath("AnimatedSprite/CollisionArea") +CollisionShape2D = NodePath("AnimatedSprite/CollisionArea/CollisionShape2D") ShadowSprite = NodePath("ShadowSprite") AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") diff --git a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0002.tscn b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0002.tscn index b1a1813..f2e1881 100644 --- a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0002.tscn +++ b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0002.tscn @@ -32,10 +32,11 @@ [sub_resource type="CircleShape2D" id="CircleShape2D_e2yn3"] radius = 3.0 -[node name="Bullet0002" type="CharacterBody2D" node_paths=PackedStringArray("CollisionArea", "ShadowSprite", "AnimatedSprite", "Collision")] +[node name="Bullet0002" type="CharacterBody2D" node_paths=PackedStringArray("CollisionArea", "CollisionShape2D", "ShadowSprite", "AnimatedSprite", "Collision")] collision_layer = 2 script = ExtResource("1_hepay") CollisionArea = NodePath("AnimatedSprite/CollisionArea") +CollisionShape2D = NodePath("AnimatedSprite/CollisionArea/CollisionShape2D") ShadowSprite = NodePath("ShadowSprite") AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") diff --git a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0003.tscn b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0003.tscn index 65b9e2a..638f697 100644 --- a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0003.tscn +++ b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0003.tscn @@ -29,10 +29,11 @@ [sub_resource type="RectangleShape2D" id="RectangleShape2D_c0onq"] size = Vector2(6, 3.125) -[node name="Bullet0003" type="CharacterBody2D" node_paths=PackedStringArray("CollisionArea", "ShadowSprite", "AnimatedSprite", "Collision")] +[node name="Bullet0003" type="CharacterBody2D" node_paths=PackedStringArray("CollisionArea", "CollisionShape2D", "ShadowSprite", "AnimatedSprite", "Collision")] collision_layer = 2 script = ExtResource("1_h6lfm") CollisionArea = NodePath("AnimatedSprite/CollisionArea") +CollisionShape2D = NodePath("AnimatedSprite/CollisionArea/CollisionShape2D") ShadowSprite = NodePath("ShadowSprite") AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") diff --git a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0004.tscn b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0004.tscn index df7551b..294456c 100644 --- a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0004.tscn +++ b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0004.tscn @@ -58,11 +58,12 @@ color = Color(0.619608, 0.619608, 0.619608, 1) anim_offset_max = 1.0 -[node name="Bullet0003" type="CharacterBody2D" node_paths=PackedStringArray("Particles", "CollisionArea", "ShadowSprite", "AnimatedSprite", "Collision")] +[node name="Bullet0003" type="CharacterBody2D" node_paths=PackedStringArray("Particles", "CollisionArea", "CollisionShape2D", "ShadowSprite", "AnimatedSprite", "Collision")] collision_layer = 2 script = ExtResource("1_1jbgr") Particles = NodePath("AnimatedSprite/GPUParticles2D") CollisionArea = NodePath("AnimatedSprite/CollisionArea") +CollisionShape2D = NodePath("AnimatedSprite/CollisionArea/CollisionShape2D") ShadowSprite = NodePath("ShadowSprite") AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") diff --git a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0005.tscn b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0005.tscn index 65fd1c7..6b0b303 100644 --- a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0005.tscn +++ b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0005.tscn @@ -29,10 +29,11 @@ [sub_resource type="RectangleShape2D" id="RectangleShape2D_c0onq"] size = Vector2(6, 3.125) -[node name="Bullet0005" type="CharacterBody2D" node_paths=PackedStringArray("CollisionArea", "ShadowSprite", "AnimatedSprite", "Collision")] +[node name="Bullet0005" type="CharacterBody2D" node_paths=PackedStringArray("CollisionArea", "CollisionShape2D", "ShadowSprite", "AnimatedSprite", "Collision")] collision_layer = 2 script = ExtResource("1_vpnof") CollisionArea = NodePath("AnimatedSprite/CollisionArea") +CollisionShape2D = NodePath("AnimatedSprite/CollisionArea/CollisionShape2D") ShadowSprite = NodePath("ShadowSprite") AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") diff --git a/DungeonShooting_Godot/resource/config/ActivityMaterial.json b/DungeonShooting_Godot/resource/config/ActivityMaterial.json index 0ada830..505d7ec 100644 --- a/DungeonShooting_Godot/resource/config/ActivityMaterial.json +++ b/DungeonShooting_Godot/resource/config/ActivityMaterial.json @@ -4,47 +4,55 @@ "Remark": "\u9ED8\u8BA4\u6750\u8D28\u5C5E\u6027", "Friction": 140, "GravityScale": 1, + "RotationType": 0, "RotationFriction": 140, "Bounce": true, "BounceStrength": 0.5, "FallBounceStrength": 0.5, "FallBounceSpeed": 0.75, - "FallBounceRotation": 0.5 + "FallBounceRotation": 0.5, + "DynamicCollision": false }, { "Id": "0002", "Remark": "\u7403\u4F53\u6750\u8D28\uFF0C\u6469\u64E6\u529B\u8F83\u4F4E", "Friction": 40, "GravityScale": 1, + "RotationType": 1, "RotationFriction": 40, "Bounce": true, "BounceStrength": 0.7, "FallBounceStrength": 0.7, "FallBounceSpeed": 0.85, - "FallBounceRotation": 0.85 + "FallBounceRotation": 0.85, + "DynamicCollision": true }, { "Id": "0003", "Remark": "\u666E\u901A\u5B50\u5F39,\u53CD\u5F39\u6D88\u8017\u4F4E,\u65E0\u91CD\u529B\u4E0B\u5760", "Friction": 140, "GravityScale": 0, + "RotationType": 1, "RotationFriction": 140, "Bounce": true, "BounceStrength": 1, "FallBounceStrength": 0.5, "FallBounceSpeed": 0.75, - "FallBounceRotation": 0.5 + "FallBounceRotation": 0.5, + "DynamicCollision": true }, { "Id": "0004", "Remark": "\u6B63\u5E38\u91CD\u529B\u5B50\u5F39", "Friction": 140, "GravityScale": 1, + "RotationType": 2, "RotationFriction": 140, "Bounce": true, "BounceStrength": 1, "FallBounceStrength": 0.5, "FallBounceSpeed": 0.75, - "FallBounceRotation": 0.5 + "FallBounceRotation": 0.5, + "DynamicCollision": true } ] \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/config/BulletBase.json b/DungeonShooting_Godot/resource/config/BulletBase.json index 104ffd0..2d6abe5 100644 --- a/DungeonShooting_Godot/resource/config/BulletBase.json +++ b/DungeonShooting_Godot/resource/config/BulletBase.json @@ -201,7 +201,7 @@ 360 ], "VerticalSpeed": [ - 70 + 170 ], "BounceCount": [ 0 diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_ActivityMaterial.cs b/DungeonShooting_Godot/src/config/ExcelConfig_ActivityMaterial.cs index 3ce5304..f3fa9c6 100644 --- a/DungeonShooting_Godot/src/config/ExcelConfig_ActivityMaterial.cs +++ b/DungeonShooting_Godot/src/config/ExcelConfig_ActivityMaterial.cs @@ -32,6 +32,15 @@ public float GravityScale; /// + /// 物体旋转控制类型:
+ /// 0.不受运动影响
+ /// 1.只受水平方向运动速度影响
+ /// 2.受水平和垂直运动方向影响, 可以做迫击炮炮弹的效果 + ///
+ [JsonInclude] + public byte RotationType; + + /// /// 旋转摩擦力 /// [JsonInclude] @@ -68,6 +77,12 @@ public float FallBounceRotation; /// + /// 动态开关碰撞器,在物体高度大于16时是否关闭碰撞检测 + /// + [JsonInclude] + public bool DynamicCollision; + + /// /// 返回浅拷贝出的新对象 /// public ActivityMaterial Clone() @@ -77,12 +92,14 @@ inst.Remark = Remark; inst.Friction = Friction; inst.GravityScale = GravityScale; + inst.RotationType = RotationType; inst.RotationFriction = RotationFriction; inst.Bounce = Bounce; inst.BounceStrength = BounceStrength; inst.FallBounceStrength = FallBounceStrength; inst.FallBounceSpeed = FallBounceSpeed; inst.FallBounceRotation = FallBounceRotation; + inst.DynamicCollision = DynamicCollision; return inst; } } diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs index 1129a3e..109eb8e 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs @@ -20,7 +20,7 @@ /// /// 当前物体对应的配置数据, 如果不是通过 ActivityObject.Create() 函数创建出来的对象那么 ItemConfig 为 null /// - public ExcelConfig.ActivityBase ItemConfig { get; private set; } + public ExcelConfig.ActivityBase ActivityBase { get; private set; } /// /// 是否是静态物体, 如果为true, 则会禁用移动处理 @@ -163,11 +163,6 @@ /// 是否启用垂直方向上的运动模拟, 默认开启, 如果禁用, 那么下落和投抛效果, 同样 Throw() 函数也将失效 /// public bool EnableVerticalMotion { get; set; } = true; - - /// - /// 撞到墙壁反弹时是否锁定旋转角度, 如果为 false, 则反弹后将直接修改旋转角度 - /// - public bool BounceLockRotation { get; set; } = true; /// /// 是否启用物体更新行为, 默认 true, 如果禁用, 则会停止当前物体的 Process(), PhysicsProcess() 调用, 并且禁用 Collision 节点, 禁用后所有组件也同样被禁用行为 @@ -364,7 +359,7 @@ } World = world; - ItemConfig = config; + ActivityBase = config; Name = GetType().Name + (_instanceIndex++); _blendShaderMaterial = AnimatedSprite.Material as ShaderMaterial; _shadowBlendShaderMaterial = ShadowSprite.Material as ShaderMaterial; @@ -1111,7 +1106,7 @@ _altitude += VerticalSpeed * delta; _verticalSpeed -= GameConfig.G * ActivityMaterial.GravityScale * delta; - //当高度大于16时, 显示在所有物体上 + //当高度大于16时, 显示在所有物体上, 并且关闭碰撞 if (Altitude >= 16) { AnimatedSprite.ZIndex = 20; @@ -1120,6 +1115,11 @@ { AnimatedSprite.ZIndex = 0; } + //动态开关碰撞器 + if (ActivityMaterial.DynamicCollision) + { + Collision.Disabled = Altitude >= 16; + } //达到最高点 if (ysp > 0 && ysp * VerticalSpeed < 0) diff --git a/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs b/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs index f193d53..8c57a64 100644 --- a/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs +++ b/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs @@ -347,20 +347,16 @@ //新速度 var newVelocity = Master.Velocity; - if (!Master.BounceLockRotation) //跟着反弹角度 - { - Rotation = newVelocity.Angle(); - } - if (newVelocity.X == 0f && _basisVelocity.X * finallyVelocity.X > 0) - { - _basisVelocity.X = 0; - } - - if (newVelocity.Y == 0f && _basisVelocity.Y * finallyVelocity.Y > 0) - { - _basisVelocity.Y = 0; - } + // if (newVelocity.X == 0f && _basisVelocity.X * finallyVelocity.X > 0) + // { + // _basisVelocity.X = 0; + // } + // + // if (newVelocity.Y == 0f && _basisVelocity.Y * finallyVelocity.Y > 0) + // { + // _basisVelocity.Y = 0; + // } //是否撞到物体 KinematicCollision2D collision; @@ -379,10 +375,15 @@ newVelocity = finallyEf.Reflect(no); var rotation = newVelocity.Angle(); - if (!Master.BounceLockRotation) //跟着反弹角度 + if (Master.ActivityMaterial.RotationType == 1) //跟着反弹角度 { Rotation = rotation; } + else if (Master.ActivityMaterial.RotationType == 2) //跟着反弹角度, 带垂直角度 + { + Rotation = rotation; + AnimatedSprite.Rotation = new Vector2(newVelocity.X, newVelocity.Y - Master.VerticalSpeed).Angle() - rotation; + } var length = _forceList.Count; if (length != 0) @@ -399,6 +400,16 @@ } else //没有撞到物体 { + if (Master.ActivityMaterial.RotationType == 1) //跟着反弹角度 + { + Rotation = newVelocity.Angle(); + } + else if (Master.ActivityMaterial.RotationType == 2) //跟着反弹角度, 带垂直角度 + { + var rotation = Rotation = newVelocity.Angle(); + AnimatedSprite.Rotation = new Vector2(newVelocity.X, newVelocity.Y - Master.VerticalSpeed).Angle() - rotation; + } + //调整外力速率 for (var i = 0; i < _forceList.Count; i++) { diff --git a/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs b/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs index fe66f00..b3ef7bf 100644 --- a/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs +++ b/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs @@ -90,7 +90,7 @@ //如果是玩家 if (activityObject == Player.Current) { - OnPlayerInsertRoom(); + CallDeferred(nameof(OnPlayerInsertRoom)); } } @@ -238,8 +238,7 @@ if (body is ActivityObject activityObject) { _enterItems.Add(activityObject); - //注意需要延时调用 - CallDeferred(nameof(InsertItem), activityObject); + InsertItem(activityObject); } } diff --git a/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs b/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs index e825d05..a3d59c1 100644 --- a/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs +++ b/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs @@ -16,10 +16,16 @@ public string Logotype { get; set; } /// - /// 碰撞区域 + /// 子弹伤害碰撞区域 /// [Export, ExportFillNode] public Area2D CollisionArea { get; set; } + + /// + /// 子弹伤害碰撞检测形状 + /// + [Export, ExportFillNode] + public CollisionShape2D CollisionShape2D { get; set; } /// /// 攻击的层级 @@ -54,14 +60,11 @@ CollisionArea.AreaEntered += OnArea2dEntered; _init = true; } - - Debug.Log("g: " + ActivityMaterial.GravityScale + ", " + EnableVerticalMotion + ", " + VerticalSpeed); CurrentBounce = 0; CurrentPenetration = 0; CurrFlyDistance = 0; - BounceLockRotation = false; BulletData = data; AttackLayer = attackLayer; Rotation = data.Rotation; @@ -106,7 +109,6 @@ this.CallDelay(data.LifeTime, OnLimeOver); } } - public override void OnMoveCollision(KinematicCollision2D collision) { @@ -213,6 +215,11 @@ protected override void Process(float delta) { + if (ActivityMaterial.DynamicCollision) + { + //子弹高度大于 16 关闭碰撞检测 + CollisionShape2D.Disabled = Altitude >= 16; + } //距离太大, 自动销毁 CurrFlyDistance += BulletData.FlySpeed * delta; if (CurrFlyDistance >= BulletData.MaxDistance) diff --git a/DungeonShooting_Godot/src/game/activity/package/Package.cs b/DungeonShooting_Godot/src/game/activity/package/Package.cs index 4dd43dd..301cd98 100644 --- a/DungeonShooting_Godot/src/game/activity/package/Package.cs +++ b/DungeonShooting_Godot/src/game/activity/package/Package.cs @@ -153,7 +153,7 @@ for (var i = 0; i < ItemSlot.Length; i++) { var item = ItemSlot[i]; - if (item != null && item.ItemConfig.Id == id) + if (item != null && item.ActivityBase.Id == id) { return i; } @@ -422,7 +422,7 @@ for (var i = 0; i < ItemSlot.Length; i++) { var packageItem = ItemSlot[i]; - if (packageItem != null && packageItem.ItemConfig.Id == itemId) + if (packageItem != null && packageItem.ActivityBase.Id == itemId) { return i; } @@ -444,7 +444,7 @@ for (var i = 0; i < ItemSlot.Length; i++) { var packageItem = ItemSlot[i]; - if (packageItem != null && packageItem.ItemConfig.Id == itemId) + if (packageItem != null && packageItem.ActivityBase.Id == itemId) { return packageItem; } diff --git a/DungeonShooting_Godot/src/game/activity/prop/active/ActiveProp.cs b/DungeonShooting_Godot/src/game/activity/prop/active/ActiveProp.cs index aaa78c3..28aaa0b 100644 --- a/DungeonShooting_Godot/src/game/activity/prop/active/ActiveProp.cs +++ b/DungeonShooting_Godot/src/game/activity/prop/active/ActiveProp.cs @@ -230,7 +230,7 @@ { if (master is Player player) { - var item = player.ActivePropsPack.GetItemById(ItemConfig.Id); + var item = player.ActivePropsPack.GetItemById(ActivityBase.Id); if (item == null) //没有同类型物体 { if (!player.ActivePropsPack.HasVacancy()) //没有空位置, 扔掉当前道具 @@ -269,7 +269,7 @@ if (master is Player player) { //查找相同类型的道具 - var item = player.ActivePropsPack.GetItemById(ItemConfig.Id); + var item = player.ActivePropsPack.GetItemById(ActivityBase.Id); if (item == null) //没有同类型物体 { if (player.ActivePropsPack.HasVacancy()) //还有空位, 拾起道具 diff --git a/DungeonShooting_Godot/src/game/activity/role/enemy/AdvancedEnemy.cs b/DungeonShooting_Godot/src/game/activity/role/enemy/AdvancedEnemy.cs index da83f71..7166519 100644 --- a/DungeonShooting_Godot/src/game/activity/role/enemy/AdvancedEnemy.cs +++ b/DungeonShooting_Godot/src/game/activity/role/enemy/AdvancedEnemy.cs @@ -490,7 +490,7 @@ return; } - var index = WeaponPack.FindIndex((we, i) => we.ItemConfig.Id == weapon.ItemConfig.Id); + var index = WeaponPack.FindIndex((we, i) => we.ActivityBase.Id == weapon.ActivityBase.Id); if (index != -1) //与武器背包中武器类型相同, 补充子弹 { if (!WeaponPack.GetItem(index).IsAmmoFull()) diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs index bd7b4ba..b3ff8a1 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs @@ -284,7 +284,7 @@ public override void OnInit() { - InitWeapon(GetWeaponAttribute(ItemConfig.Id).Clone()); + InitWeapon(GetWeaponAttribute(ActivityBase.Id).Clone()); AnimatedSprite.AnimationFinished += OnAnimationFinished; } @@ -307,7 +307,7 @@ if (Attribute.AmmoCapacity > Attribute.MaxAmmoCapacity) { Attribute.AmmoCapacity = Attribute.MaxAmmoCapacity; - Debug.LogError("弹夹的容量不能超过弹药上限, 武器id: " + ItemConfig.Id); + Debug.LogError("弹夹的容量不能超过弹药上限, 武器id: " + ActivityBase.Id); } //弹药量 CurrAmmo = Attribute.AmmoCapacity; @@ -1612,7 +1612,7 @@ { var masterWeapon = roleMaster.WeaponPack.ActiveItem; //查找是否有同类型武器 - var index = roleMaster.WeaponPack.FindIndex(ItemConfig.Id); + var index = roleMaster.WeaponPack.FindIndex(ActivityBase.Id); if (index != -1) //如果有这个武器 { if (CurrAmmo + ResidueAmmo != 0) //子弹不为空 @@ -1656,7 +1656,7 @@ { var holster = roleMaster.WeaponPack; //查找是否有同类型武器 - var index = holster.FindIndex(ItemConfig.Id); + var index = holster.FindIndex(ActivityBase.Id); if (index != -1) //如果有这个武器 { if (CurrAmmo + ResidueAmmo == 0) //没有子弹了 diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/InteractiveTipBar.cs b/DungeonShooting_Godot/src/game/ui/roomUI/InteractiveTipBar.cs index 3203984..3dd9265 100644 --- a/DungeonShooting_Godot/src/game/ui/roomUI/InteractiveTipBar.cs +++ b/DungeonShooting_Godot/src/game/ui/roomUI/InteractiveTipBar.cs @@ -70,7 +70,7 @@ { _interactiveTarget = interactiveItem; //显示互动提示 - ShowBar(result.Target, result.Target.ItemConfig.Name, icon); + ShowBar(result.Target, result.Target.ActivityBase.Name, icon); } else { diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/RoomUIPanel.cs b/DungeonShooting_Godot/src/game/ui/roomUI/RoomUIPanel.cs index 56f26c3..85aa871 100644 --- a/DungeonShooting_Godot/src/game/ui/roomUI/RoomUIPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/roomUI/RoomUIPanel.cs @@ -60,7 +60,7 @@ private void OnPlayerPickUpProp(object propObj) { var prop = (Prop)propObj; - var message = $"{prop.ItemConfig.Name}\n{prop.ItemConfig.Intro}"; + var message = $"{prop.ActivityBase.Name}\n{prop.ActivityBase.Intro}"; BottomTipsPanel.ShowTips(prop.GetDefaultTexture(), message); } } \ No newline at end of file