diff --git a/DungeonShooting_Godot/prefab/role/Player.tscn b/DungeonShooting_Godot/prefab/role/Player.tscn
index e2b99e5..eb6fbe7 100644
--- a/DungeonShooting_Godot/prefab/role/Player.tscn
+++ b/DungeonShooting_Godot/prefab/role/Player.tscn
@@ -12,9 +12,6 @@
script = ExtResource( 2 )
GunPrefab = ExtResource( 4 )
-[node name="AnimatedSprite" parent="." index="0"]
-frame = 3
-
[node name="ColorRect" type="ColorRect" parent="." index="6"]
visible = false
margin_left = -9.0
diff --git a/DungeonShooting_Godot/src/effect/ThrowNode.cs b/DungeonShooting_Godot/src/effect/ThrowNode.cs
index 73094ca..5073764 100644
--- a/DungeonShooting_Godot/src/effect/ThrowNode.cs
+++ b/DungeonShooting_Godot/src/effect/ThrowNode.cs
@@ -211,12 +211,16 @@
}
///
- /// /// 结束的调用
+ /// 结束的调用
///
protected virtual void OnOver()
{
GetParent().RemoveChild(this);
RoomManager.Current.ObjectRoot.AddChild(this);
+ if (CollisionShape != null)
+ {
+ CollisionShape.Disabled = true;
+ }
}
public override void _Process(float delta)
@@ -250,10 +254,6 @@
{
Mount.Position = new Vector2(0, 0);
IsOver = true;
- if (CollisionShape != null)
- {
- CollisionShape.Disabled = true;
- }
OnOver();
}
}
diff --git a/DungeonShooting_Godot/src/role/Player.cs b/DungeonShooting_Godot/src/role/Player.cs
index 4718b69..1d60a92 100644
--- a/DungeonShooting_Godot/src/role/Player.cs
+++ b/DungeonShooting_Godot/src/role/Player.cs
@@ -138,13 +138,13 @@
{
if (InteractiveItem == null)
{
- //GD.Print("没有可互动的道具了");
+ GD.Print("没有可互动的道具了");
}
else
{
if (InteractiveItem is Gun gun)
{
- //GD.Print("更新可互动的道具: " + gun.Attribute.Name);
+ GD.Print("更新可互动的道具: " + gun.Attribute.Name);
}
}
}
diff --git a/DungeonShooting_Godot/src/role/Role.cs b/DungeonShooting_Godot/src/role/Role.cs
index 03e1ce6..95c587f 100644
--- a/DungeonShooting_Godot/src/role/Role.cs
+++ b/DungeonShooting_Godot/src/role/Role.cs
@@ -147,7 +147,7 @@
if (InteractiveItem != item)
{
InteractiveItem = item;
- GD.Print("--------change");
+ //GD.Print("--------change");
ChangeInteractiveItem();
}
}
@@ -157,7 +157,7 @@
if (!findFlag && InteractiveItem != null)
{
InteractiveItem = null;
- GD.Print("--------remove1");
+ //GD.Print("--------remove1");
ChangeInteractiveItem();
}
}
@@ -291,7 +291,7 @@
if (!InteractiveItemList.Contains(prop))
{
InteractiveItemList.Add(prop);
- GD.Print("--------add");
+ //GD.Print("--------add");
}
}
}
@@ -307,11 +307,11 @@
if (InteractiveItemList.Contains(prop))
{
InteractiveItemList.Remove(prop);
+ //GD.Print("--------remove2");
}
if (InteractiveItem == prop)
{
InteractiveItem = null;
- GD.Print("--------remove2");
ChangeInteractiveItem();
}
}
diff --git a/DungeonShooting_Godot/src/weapon/gun/Gun.cs b/DungeonShooting_Godot/src/weapon/gun/Gun.cs
index a774bc7..5098bd6 100644
--- a/DungeonShooting_Godot/src/weapon/gun/Gun.cs
+++ b/DungeonShooting_Godot/src/weapon/gun/Gun.cs
@@ -429,6 +429,22 @@
}
///
+ /// 返回弹药是否到达上限
+ ///
+ public bool IsFullAmmo()
+ {
+ return CurrAmmo + ResidueAmmo >= Attribute.MaxAmmoCapacity;
+ }
+
+ ///
+ /// 返回是否弹药耗尽
+ ///
+ public bool IsEmptyAmmo()
+ {
+ return CurrAmmo + ResidueAmmo == 0;
+ }
+
+ ///
/// 拾起的弹药数量, 如果到达容量上限, 则返回拾取完毕后剩余的弹药数量
///
/// 弹药数量
@@ -479,6 +495,7 @@
public bool CanTnteractive(Role master)
{
+ var masterGun = master.Holster.ActiveGun;
//查找是否有同类型武器
var index = master.Holster.FindGun(Attribute.Id);
if (index != -1) //如果有这个武器
@@ -487,10 +504,18 @@
{
return false;
}
+ else if (masterGun != null && masterGun.IsFullAmmo()) //子弹满了
+ {
+ return false;
+ }
}
else //没有武器
{
- if (!master.Holster.CanPickupGun(this))
+ if (masterGun != null && masterGun.Attribute.WeightType == Attribute.WeightType)
+ {
+ return true;
+ }
+ else if (!master.Holster.CanPickupGun(this))
{
return false;
}