Newer
Older
DungeonShooting / DungeonShooting_Godot / src / game / buff / buff / Buff_BulletBounceCount.cs
@小李xl 小李xl on 22 Mar 2024 720 bytes 道具逻辑片段更新参数描述

using System.Text.Json;

[BuffFragment(
    "BulletBounceCount", "子弹弹射数量 buff",
    Arg1 = "(int)子弹增加的弹射次数"
)]
public class Buff_BulletBounceCount : BuffFragment
{
    private int _value;

    public override void InitParam(JsonElement[] arg)
    {
        _value = arg[0].GetInt32();
    }

    public override void OnPickUpItem()
    {
        Role.RoleState.CalcBulletBounceCountEvent += CalcBulletBounceCountEvent;
    }

    public override void OnRemoveItem()
    {
        Role.RoleState.CalcBulletBounceCountEvent -= CalcBulletBounceCountEvent;
    }

    private void CalcBulletBounceCountEvent(int originBounce, RefValue<int> bounce)
    {
        bounce.Value += _value;
    }
}