Blade & Sorcery
0 of 0

File information

Last updated

Original upload

Created by

Basalt

Uploaded by

BasilBasalt

Virus scan

Safe to use

Tags for this mod

About this mod

Extending and retracting mounted blades using Boneholsters

Requirements
Permissions and credits
PLEASE UPDATE BONEHOLSTERS TO THE LATEST VERSION OR THIS WILL NOT WORK


Found in Exotics

Trigger each blade with the trigger button, left and right respectively.




CODE:

using UnityEngine;
using BS;

namespace HiddenBladeL
{
    public class BladeL : MonoBehaviour
    {
        Item item;

        bool stateClosed = true;

        float animDelay = 2f;

        public void Awake()
        {
            item = this.GetComponent<Item>();
        }
        public void Update()
        {
            bool triggerPressed = PlayerControl.handLeft.usePressed;

            animDelay -= Time.deltaTime;

            if (triggerPressed == true && animDelay <= 0f)
            {
                if (stateClosed == true)
                {
                    item.definition.GetCustomReference("SoundOpen").GetComponent<AudioSource>().Play();
                    item.definition.GetCustomReference("AnimationOpen").GetComponent<Animation>().Play();
                    stateClosed = false;
                    animDelay = 0.5f;
                }
                else
                {
                    item.definition.GetCustomReference("SoundClose").GetComponent<AudioSource>().Play();
                    item.definition.GetCustomReference("AnimationClose").GetComponent<Animation>().Play();
                    stateClosed = true;
                    animDelay = 0.5f;
                }
            }
        }
    }
}