diff --git a/prefab/weapons/staffOfTheUndead.tscn b/prefab/weapons/staffOfTheUndead.tscn index d4732bf..ca0c9c0 100644 --- a/prefab/weapons/staffOfTheUndead.tscn +++ b/prefab/weapons/staffOfTheUndead.tscn @@ -16,6 +16,7 @@ collision_mask = 34 script = ExtResource("1_w8hhv") ProjectileScenes = [ExtResource("2_34250")] Id = "staff_of_the_undead" +FiringIntervalAsMillisecond = 300 metadata/Projectiles = PackedStringArray("res://prefab/projectile/curseOfTheUndead.tscn") [node name="DamageArea2D" type="Area2D" parent="."] diff --git a/scripts/item/weapon/WeaponTemplate.cs b/scripts/item/weapon/WeaponTemplate.cs index e05fc82..c7e600a 100644 --- a/scripts/item/weapon/WeaponTemplate.cs +++ b/scripts/item/weapon/WeaponTemplate.cs @@ -3,6 +3,7 @@ using System; using ColdMint.scripts.camp; using ColdMint.scripts.character; using ColdMint.scripts.damage; + using Godot; namespace ColdMint.scripts.item.weapon; @@ -70,7 +71,16 @@ public abstract partial class WeaponTemplate : RigidBody2D, IItem /// 开火间隔 /// private TimeSpan _firingInterval; - [Export] private long _firingIntervalAsMillisecond = 100; + private long _firingIntervalAsMillisecond = 100; + [Export] protected long FiringIntervalAsMillisecond + { + get => _firingIntervalAsMillisecond; + set + { + _firingIntervalAsMillisecond = value; + _firingInterval = TimeSpan.FromMilliseconds(_firingIntervalAsMillisecond); + } + } /// @@ -101,8 +111,6 @@ public abstract partial class WeaponTemplate : RigidBody2D, IItem _damageArea2D = GetNode("DamageArea2D"); _damageArea2D.BodyEntered += OnBodyEnter; _damageArea2D.BodyExited += OnBodyExited; - - _firingInterval = TimeSpan.FromMilliseconds(_firingIntervalAsMillisecond); } private void OnBodyExited(Node node)