diff --git a/DungeonShooting_Godot/src/game/item/weapon/RegisterWeapon.cs b/DungeonShooting_Godot/src/game/item/weapon/RegisterWeapon.cs new file mode 100644 index 0000000..6ee6ea3 --- /dev/null +++ b/DungeonShooting_Godot/src/game/item/weapon/RegisterWeapon.cs @@ -0,0 +1,24 @@ + +using System; + +/// +/// 注册武器 +/// +public class RegisterWeapon : RegisterActivity +{ + public WeaponAttribute WeaponAttribute { get; } + + public RegisterWeapon(string id, Type attribute) : base(id, null) + { + WeaponAttribute = (WeaponAttribute)Activator.CreateInstance(attribute); + if (WeaponAttribute != null) PrefabPath = WeaponAttribute.WeaponPrefab; + } + + public override void CustomHandler(ActivityObject instance) + { + if (instance is Weapon weapon) + { + weapon.InitWeapon(WeaponAttribute.Clone()); + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/item/weapon/bullet/RegisterWeapon.cs b/DungeonShooting_Godot/src/game/item/weapon/bullet/RegisterWeapon.cs deleted file mode 100644 index 6ee6ea3..0000000 --- a/DungeonShooting_Godot/src/game/item/weapon/bullet/RegisterWeapon.cs +++ /dev/null @@ -1,24 +0,0 @@ - -using System; - -/// -/// 注册武器 -/// -public class RegisterWeapon : RegisterActivity -{ - public WeaponAttribute WeaponAttribute { get; } - - public RegisterWeapon(string id, Type attribute) : base(id, null) - { - WeaponAttribute = (WeaponAttribute)Activator.CreateInstance(attribute); - if (WeaponAttribute != null) PrefabPath = WeaponAttribute.WeaponPrefab; - } - - public override void CustomHandler(ActivityObject instance) - { - if (instance is Weapon weapon) - { - weapon.InitWeapon(WeaponAttribute.Clone()); - } - } -} \ No newline at end of file