锯肉刀 (U6)

锯肉刀 (U6)

血源诅咒的初始武器之一,锯肉刀!按下动作键可变换形态。观看内部视频以查看实际效果。锯齿面如同斧头,薄面如同剑,还可以用尖刺进行穿刺。

武器

血源诅咒火器:

血源诅咒变形武器:

血源诅咒杂项:

public class ItemSawCleaver : MonoBehaviour { protected Item item; public Transform blade; public bool isExtended = false; public bool isChanging = false; public float rotation = 175f; public float speed = 35f; public float count = 0; public ParticleSystem sparks; public AudioSource trickSFX; public GameObject spike;

protected void Awake()
{
    item = this.GetComponent<Item>();
    item.OnHeldActionEvent += OnHeldAction;
    blade = item.transform.Find("Blade");
    sparks = item.transform.Find("Sparks").GetComponent<ParticleSystem>();
    trickSFX = item.transform.Find("TrickSound").GetComponent<AudioSource>();
    spike = blade.Find("BladeColliders").Find("SpikeCollider").gameObject;
    spike.SetActive(false);
}

public void OnHeldAction(Interactor interactor, Handle handle, Interactable.Action action)
{
    if (action == Interactable.Action.AlternateUseStop)
    {
        isChanging = true;
    }
}

void FixedUpdate()
{
    if (isChanging)
    {
        ChangeWeapon();
    }
}

public void ChangeWeapon()
{
    if (isExtended)
    {
        blade.Rotate(0f, 0f, rotation / speed);
        count++;
        if (count >= speed)
        {
            sparks.Play();
            trickSFX.Play();
            count = 0f;
            isExtended = false;
            isChanging = false;
            spike.SetActive(false);
            item.rb.mass = 1f;
        }
    }
    else
    {
        blade.Rotate(0f, 0f, -rotation / speed);
        count++;
        if (count >= speed)
        {
            sparks.Play();
            trickSFX.Play();
            count = 0f;
            isExtended = true;
            isChanging = false;
            spike.SetActive(true);
            item.rb.mass = 2f;
        }
    }
}

}