diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffActivity.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffActivity.cs
new file mode 100644
index 0000000..1dfc591
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffActivity.cs
@@ -0,0 +1,101 @@
+
+using System.Collections.Generic;
+using Godot;
+
+///
+/// 通用被动道具实体类
+///
+[Tool]
+public partial class BuffActivity : Prop
+{
+ private readonly List _buffFragment = new List();
+
+ public override void OnPickUpItem()
+ {
+ foreach (var buffFragment in _buffFragment)
+ {
+ buffFragment.OnPickUpItem();
+ }
+ }
+
+ public override void OnRemoveItem()
+ {
+ foreach (var buffFragment in _buffFragment)
+ {
+ buffFragment.OnRemoveItem();
+ }
+ }
+
+ public void AddBuffFragment() where T : BuffFragment, new()
+ {
+ var fragment = AddComponent();
+ _buffFragment.Add(fragment);
+ fragment.Init();
+ if (Master != null)
+ {
+ fragment.OnPickUpItem();
+ }
+ }
+
+ public void AddBuffFragment(float arg1) where T : BuffFragment, new()
+ {
+ var fragment = AddComponent();
+ _buffFragment.Add(fragment);
+ fragment.Init(arg1);
+ if (Master != null)
+ {
+ fragment.OnPickUpItem();
+ }
+ }
+
+ public void AddBuffFragment(float arg1, float arg2) where T : BuffFragment, new()
+ {
+ var fragment = AddComponent();
+ _buffFragment.Add(fragment);
+ fragment.Init(arg1, arg2);
+ if (Master != null)
+ {
+ fragment.OnPickUpItem();
+ }
+ }
+
+ public void AddBuffFragment(float arg1, float arg2, float arg3) where T : BuffFragment, new()
+ {
+ var fragment = AddComponent();
+ _buffFragment.Add(fragment);
+ fragment.Init(arg1, arg2, arg3);
+ if (Master != null)
+ {
+ fragment.OnPickUpItem();
+ }
+ }
+
+ public void AddBuffFragment(float arg1, float arg2, float arg3, float arg4) where T : BuffFragment, new()
+ {
+ var fragment = AddComponent();
+ _buffFragment.Add(fragment);
+ fragment.Init(arg1, arg2, arg3, arg4);
+ if (Master != null)
+ {
+ fragment.OnPickUpItem();
+ }
+ }
+
+ public override void Interactive(ActivityObject master)
+ {
+ if (master is Player role)
+ {
+ Pickup();
+ role.PickUpBuffProp(this);
+ }
+ }
+
+ public override CheckInteractiveResult CheckInteractive(ActivityObject master)
+ {
+ if (master is Player)
+ {
+ return new CheckInteractiveResult(this, true, CheckInteractiveResult.InteractiveType.PickUp);
+ }
+ return base.CheckInteractive(master);
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp.cs
deleted file mode 100644
index de5cd38..0000000
--- a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-
-///
-/// 被动增益道具
-///
-public abstract partial class BuffProp : Prop
-{
- public override void Interactive(ActivityObject master)
- {
- if (master is Player role)
- {
- Pickup();
- role.PickUpBuffProp(this);
- }
- }
-
- public override CheckInteractiveResult CheckInteractive(ActivityObject master)
- {
- if (master is Player)
- {
- return new CheckInteractiveResult(this, true, CheckInteractiveResult.InteractiveType.PickUp);
- }
- return base.CheckInteractive(master);
- }
-}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0001.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0001.cs
index 50c3417..230c356 100644
--- a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0001.cs
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0001.cs
@@ -5,7 +5,7 @@
/// 移速 buff, 移速 + 3
///
[Tool]
-public partial class BuffProp0001 : BuffProp
+public partial class BuffProp0001 : BuffActivity
{
public override void OnPickUpItem()
{
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0002.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0002.cs
index ec3b255..da97771 100644
--- a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0002.cs
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0002.cs
@@ -5,7 +5,7 @@
/// 血量上限buff, 心之容器 + 1
///
[Tool]
-public partial class BuffProp0002 : BuffProp
+public partial class BuffProp0002 : BuffActivity
{
public override void OnPickUpItem()
{
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0003.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0003.cs
index 7ecf063..c0bf9a4 100644
--- a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0003.cs
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0003.cs
@@ -5,7 +5,7 @@
/// 护盾上限buff, 护盾 + 1
///
[Tool]
-public partial class BuffProp0003 : BuffProp
+public partial class BuffProp0003 : BuffActivity
{
public override void OnPickUpItem()
{
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0004.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0004.cs
index f66ab3b..e512590 100644
--- a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0004.cs
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0004.cs
@@ -5,7 +5,7 @@
/// 护盾恢复时间buff, 恢复时间 - 2.5s
///
[Tool]
-public partial class BuffProp0004 : BuffProp
+public partial class BuffProp0004 : BuffActivity
{
public override void OnPickUpItem()
{
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0005.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0005.cs
index 37783e6..e6f15a0 100644
--- a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0005.cs
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0005.cs
@@ -5,7 +5,7 @@
/// 提升伤害buff, 子弹伤害提升20%
///
[Tool]
-public partial class BuffProp0005 : BuffProp
+public partial class BuffProp0005 : BuffActivity
{
public override void OnPickUpItem()
{
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0006.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0006.cs
index 8076c29..fed619e 100644
--- a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0006.cs
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0006.cs
@@ -5,7 +5,7 @@
/// 延长无敌时间buff, 受伤后无敌时间 + 2s
///
[Tool]
-public partial class BuffProp0006 : BuffProp
+public partial class BuffProp0006 : BuffActivity
{
public override void OnPickUpItem()
{
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0007.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0007.cs
index e83b525..f4b2be6 100644
--- a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0007.cs
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0007.cs
@@ -5,7 +5,7 @@
/// 受伤时有15%概率抵消伤害
///
[Tool]
-public partial class BuffProp0007 : BuffProp
+public partial class BuffProp0007 : BuffActivity
{
public override void OnPickUpItem()
{
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0008.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0008.cs
index b7d2de6..ec16774 100644
--- a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0008.cs
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0008.cs
@@ -5,7 +5,7 @@
/// 眼镜, 提高武器50%精准度
///
[Tool]
-public partial class BuffProp0008 : BuffProp
+public partial class BuffProp0008 : BuffActivity
{
public override void OnPickUpItem()
{
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0009.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0009.cs
index 4fad8f8..9892fd5 100644
--- a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0009.cs
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0009.cs
@@ -5,7 +5,7 @@
/// 高速子弹 子弹速度和射程提升25%
///
[Tool]
-public partial class BuffProp0009 : BuffProp
+public partial class BuffProp0009 : BuffActivity
{
public override void OnPickUpItem()
{
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0010.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0010.cs
index 6254213..0d18ed3 100644
--- a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0010.cs
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0010.cs
@@ -5,7 +5,7 @@
/// 分裂子弹 子弹数量翻倍, 但是精准度, 击退和伤害降低
///
[Tool]
-public partial class BuffProp0010 : BuffProp
+public partial class BuffProp0010 : BuffActivity
{
public override void OnPickUpItem()
{
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0011.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0011.cs
index 6485291..dd3c3ba 100644
--- a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0011.cs
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0011.cs
@@ -5,7 +5,7 @@
/// 弹射子弹 子弹反弹次数 +2
///
[Tool]
-public partial class BuffProp0011 : BuffProp
+public partial class BuffProp0011 : BuffActivity
{
public override void OnPickUpItem()
{
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0012.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0012.cs
index a24b0fc..ba458cc 100644
--- a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0012.cs
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0012.cs
@@ -5,7 +5,7 @@
/// 穿透子弹 子弹穿透+1
///
[Tool]
-public partial class BuffProp0012 : BuffProp
+public partial class BuffProp0012 : BuffActivity
{
public override void OnPickUpItem()
{
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0013.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0013.cs
index e43270a..67065ce 100644
--- a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0013.cs
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0013.cs
@@ -4,7 +4,7 @@
/// 武器背包 武器容量+1
///
[Tool]
-public partial class BuffProp0013 : BuffProp
+public partial class BuffProp0013 : BuffActivity
{
public override void OnPickUpItem()
{
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0014.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0014.cs
index b09db41..78222cc 100644
--- a/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0014.cs
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/BuffProp0014.cs
@@ -4,7 +4,7 @@
/// 道具背包 道具容量+1
///
[Tool]
-public partial class BuffProp0014 : BuffProp
+public partial class BuffProp0014 : BuffActivity
{
public override void OnPickUpItem()
{
diff --git a/DungeonShooting_Godot/src/game/activity/role/Role.cs b/DungeonShooting_Godot/src/game/activity/role/Role.cs
index b7a454b..e0e6477 100644
--- a/DungeonShooting_Godot/src/game/activity/role/Role.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/Role.cs
@@ -54,7 +54,7 @@
///
/// 携带的被动道具列表
///
- public List BuffPropPack { get; } = new List();
+ public List BuffPropPack { get; } = new List();
///
/// 携带的主动道具包裹
@@ -452,14 +452,14 @@
///
/// 当拾起某个被动道具时调用
///
- protected virtual void OnPickUpBuffProp(BuffProp buffProp)
+ protected virtual void OnPickUpBuffProp(BuffActivity buffActivity)
{
}
///
/// 当移除某个被动道具时调用
///
- protected virtual void OnRemoveBuffProp(BuffProp buffProp)
+ protected virtual void OnRemoveBuffProp(BuffActivity buffActivity)
{
}
@@ -716,28 +716,28 @@
///
/// 拾起被动道具, 返回是否成功拾起
///
- /// 被动道具对象
- public bool PickUpBuffProp(BuffProp buffProp)
+ /// 被动道具对象
+ public bool PickUpBuffProp(BuffActivity buffActivity)
{
- if (BuffPropPack.Contains(buffProp))
+ if (BuffPropPack.Contains(buffActivity))
{
Debug.LogError("被动道具已经在背包中了!");
return false;
}
- BuffPropPack.Add(buffProp);
- buffProp.Master = this;
- OnPickUpBuffProp(buffProp);
- buffProp.OnPickUpItem();
+ BuffPropPack.Add(buffActivity);
+ buffActivity.Master = this;
+ OnPickUpBuffProp(buffActivity);
+ buffActivity.OnPickUpItem();
return true;
}
///
/// 扔掉指定的被动道具
///
- ///
- public void ThrowBuffProp(BuffProp buffProp)
+ ///
+ public void ThrowBuffProp(BuffActivity buffActivity)
{
- var index = BuffPropPack.IndexOf(buffProp);
+ var index = BuffPropPack.IndexOf(buffActivity);
if (index < 0)
{
Debug.LogError("当前道具不在角色背包中!");
diff --git a/DungeonShooting_Godot/src/game/activity/role/player/Player.cs b/DungeonShooting_Godot/src/game/activity/role/player/Player.cs
index 6153367..733491f 100644
--- a/DungeonShooting_Godot/src/game/activity/role/player/Player.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/player/Player.cs
@@ -364,14 +364,14 @@
EventManager.EmitEvent(EventEnum.OnPlayerRemoveProp, activeProp);
}
- protected override void OnPickUpBuffProp(BuffProp buffProp)
+ protected override void OnPickUpBuffProp(BuffActivity buffActivity)
{
- EventManager.EmitEvent(EventEnum.OnPlayerPickUpProp, buffProp);
+ EventManager.EmitEvent(EventEnum.OnPlayerPickUpProp, buffActivity);
}
- protected override void OnRemoveBuffProp(BuffProp buffProp)
+ protected override void OnRemoveBuffProp(BuffActivity buffActivity)
{
- EventManager.EmitEvent(EventEnum.OnPlayerRemoveProp, buffProp);
+ EventManager.EmitEvent(EventEnum.OnPlayerRemoveProp, buffActivity);
}
///
diff --git a/DungeonShooting_Godot/src/game/buff/BuffBase.cs b/DungeonShooting_Godot/src/game/buff/BuffBase.cs
deleted file mode 100644
index 45a4e6e..0000000
--- a/DungeonShooting_Godot/src/game/buff/BuffBase.cs
+++ /dev/null
@@ -1,4 +0,0 @@
-
-public abstract partial class BuffBase : Component
-{
-}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/buff/BuffFragment.cs b/DungeonShooting_Godot/src/game/buff/BuffFragment.cs
new file mode 100644
index 0000000..a470a8d
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/buff/BuffFragment.cs
@@ -0,0 +1,48 @@
+
+using System;
+
+///
+/// 被动道具逻辑基类
+///
+public abstract partial class BuffFragment : Component
+{
+ ///
+ /// 所属角色对象
+ ///
+ public Role Role => Master?.Master;
+
+ ///
+ /// 当道具被拾起时调用 (在 Master 赋值之后调用)
+ ///
+ public abstract void OnPickUpItem();
+
+ ///
+ /// 当道具被移除时调用 (在 Master 置为 null 之前调用)
+ ///
+ public abstract void OnRemoveItem();
+
+ public virtual void Init()
+ {
+ Debug.LogError($"'{GetType().FullName}'为实现0参数初始化函数!");
+ }
+
+ public virtual void Init(float arg1)
+ {
+ Debug.LogError($"'{GetType().FullName}'为实现1参数初始化函数!");
+ }
+
+ public virtual void Init(float arg1, float arg2)
+ {
+ Debug.LogError($"'{GetType().FullName}'为实现2参数初始化函数!");
+ }
+
+ public virtual void Init(float arg1, float arg2, float arg3)
+ {
+ Debug.LogError($"'{GetType().FullName}'为实现4参数初始化函数!");
+ }
+
+ public virtual void Init(float arg1, float arg2, float arg3, float arg4)
+ {
+ Debug.LogError($"'{GetType().FullName}'为实现4参数初始化函数!");
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/buff/Buff_MoveSpeed.cs b/DungeonShooting_Godot/src/game/buff/Buff_MoveSpeed.cs
deleted file mode 100644
index e69de29..0000000
--- a/DungeonShooting_Godot/src/game/buff/Buff_MoveSpeed.cs
+++ /dev/null
diff --git a/DungeonShooting_Godot/src/game/buff/fragment/Buff_MoveSpeed.cs b/DungeonShooting_Godot/src/game/buff/fragment/Buff_MoveSpeed.cs
new file mode 100644
index 0000000..1fef352
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/buff/fragment/Buff_MoveSpeed.cs
@@ -0,0 +1,18 @@
+
+public class Buff_MoveSpeed : BuffFragment
+{
+ public override void Init(float arg1)
+ {
+
+ }
+
+ public override void OnPickUpItem()
+ {
+
+ }
+
+ public override void OnRemoveItem()
+ {
+
+ }
+}
\ No newline at end of file