diff --git a/src/package/Holster.cs b/src/package/Holster.cs
index e9b517b..0251c81 100644
--- a/src/package/Holster.cs
+++ b/src/package/Holster.cs
@@ -80,17 +80,45 @@
///
/// 切换到上一个武器
///
- public void ExchangePrev()
+ public int ExchangePrev()
{
-
+ return 0;
}
///
/// 切换到下一个武器
///
- public void ExchangeNext()
+ public int ExchangeNext()
{
+ var index = ActiveIndex + 1;
+ while (index != ActiveIndex)
+ {
+ if (index >= SlotList.Length)
+ {
+ index = 0;
+ }
+ var slot = SlotList[index];
+ if (slot != null && slot.Gun != null)
+ {
+ //更改父节点
+ var parent = slot.Gun.GetParentOrNull();
+ if (parent == null)
+ {
+ Master.MountPoint.AddChild(slot.Gun);
+ }
+ else if (parent != Master.MountPoint)
+ {
+ parent.RemoveChild(slot.Gun);
+ Master.MountPoint.AddChild(slot.Gun);
+ }
+ ActiveGun = slot.Gun;
+ ActiveIndex = index;
+ return index;
+ }
+ index++;
+ }
+ return -1;
}
///
@@ -101,7 +129,18 @@
if (index > SlotList.Length) return false;
var slot = SlotList[index];
if (slot == null || slot.Gun == null) return false;
- Master.MountPoint.AddChild(slot.Gun);
+ //更改父节点
+ var parent = slot.Gun.GetParentOrNull();
+ if (parent == null)
+ {
+ Master.MountPoint.AddChild(slot.Gun);
+ }
+ else if (parent != Master.MountPoint)
+ {
+ parent.RemoveChild(slot.Gun);
+ Master.MountPoint.AddChild(slot.Gun);
+ }
+
ActiveGun = slot.Gun;
ActiveIndex = index;
return true;
diff --git a/src/role/Player.cs b/src/role/Player.cs
index 547227a..4acdb47 100644
--- a/src/role/Player.cs
+++ b/src/role/Player.cs
@@ -48,6 +48,9 @@
{
Face = FaceDirection.Left;
}
+ if (Input.IsActionJustPressed("exchange")) {
+ ExchangeNext();
+ }
//攻击
Attack();
}
diff --git a/src/role/Role.cs b/src/role/Role.cs
index 567a06c..6a5e4d0 100644
--- a/src/role/Role.cs
+++ b/src/role/Role.cs
@@ -83,7 +83,11 @@
public void ExchangeNext()
{
- Holster.ExchangeNext();
+ var index = Holster.ExchangeNext();
+ if (index != -1)
+ {
+ SetActiveGun(index);
+ }
}
private void SetActiveGun(int index)
diff --git a/src/weapon/gun/GunManager.cs b/src/weapon/gun/GunManager.cs
index ff7784d..826b956 100644
--- a/src/weapon/gun/GunManager.cs
+++ b/src/weapon/gun/GunManager.cs
@@ -11,8 +11,8 @@
//设置基础属性
var attr = new GunAttribute();
attr.StartFiringSpeed = 480;
- attr.StartScatteringRange = 5;
- attr.FinalScatteringRange = 60;
+ attr.StartScatteringRange = 30;
+ attr.FinalScatteringRange = 90;
attr.ScatteringRangeAddValue = 2f;
attr.ScatteringRangeBackSpeed = 40;
//连发