예제 #1
0
    private void Update()
    {
        if ((Input.GetKeyDown(KeyCode.Mouse0) || Input.GetAxis(playerInput[11]) > 0) && Time.time >= timestamp)
        {
            //Debug.Log("TRIGGERED");
            timestamp = Time.time + batDelay;
            if (!stunned)
            {
                Invoke("Fire", fireDelay);
                anim.Play("Armature|Hitting");
            }
        }
        if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetButtonDown(playerInput[2]))
        {
            bulletPrefab = DefaultBall; // normal
            manaCost     = bulletPrefab.GetComponent <PlayerSelector>().manaCost;
        }
        if (Input.GetKeyDown(KeyCode.Alpha2) || Input.GetButtonDown(playerInput[3]))
        {
            bulletPrefab = Bullets[Loadout[0]];
            manaCost     = bulletPrefab.GetComponent <PlayerSelector>().manaCost;
        }
        if (Input.GetKeyDown(KeyCode.Alpha3) || Input.GetButtonDown(playerInput[0]))
        {
            bulletPrefab = Bullets[Loadout[1]];
            manaCost     = bulletPrefab.GetComponent <PlayerSelector>().manaCost;
        }
        if (Input.GetKeyDown(KeyCode.Alpha4) || Input.GetButtonDown(playerInput[1]))
        {
            bulletPrefab = Bullets[Loadout[2]];
            manaCost     = bulletPrefab.GetComponent <PlayerSelector>().manaCost;
        }

        if (anim.GetBool("Moving"))
        {
            if (footstepTimer > footstepDelay)
            {
                shieldScript.SendEvent(Hv_shields_AudioLib.Event.Bangfast);
                footstepTimer = 0;
            }
            footstepTimer += Time.deltaTime;
        }
    }
    public override void OnInspectorGUI()
    {
        bool isEnabled = _dsp.IsInstantiated();

        if (!isEnabled)
        {
            EditorGUILayout.LabelField("Press Play!", EditorStyles.centeredGreyMiniLabel);
        }
        // events
        GUI.enabled = isEnabled;
        EditorGUILayout.Space();
        // bangFast
        if (GUILayout.Button("bangFast"))
        {
            _dsp.SendEvent(Hv_shields_AudioLib.Event.Bangfast);
        }

        // bangMed
        if (GUILayout.Button("bangMed"))
        {
            _dsp.SendEvent(Hv_shields_AudioLib.Event.Bangmed);
        }

        // bangSlow
        if (GUILayout.Button("bangSlow"))
        {
            _dsp.SendEvent(Hv_shields_AudioLib.Event.Bangslow);
        }

        // powerdown
        if (GUILayout.Button("powerdown"))
        {
            _dsp.SendEvent(Hv_shields_AudioLib.Event.Powerdown);
        }

        // powerup
        if (GUILayout.Button("powerup"))
        {
            _dsp.SendEvent(Hv_shields_AudioLib.Event.Powerup);
        }

        GUILayout.EndVertical();

        // parameters
        GUI.enabled = true;
        GUILayout.BeginVertical();
        EditorGUILayout.Space();
        EditorGUI.indentLevel++;

        // volume
        GUILayout.BeginHorizontal();
        float volume    = _dsp.GetFloatParameter(Hv_shields_AudioLib.Parameter.Volume);
        float newVolume = EditorGUILayout.Slider("volume", volume, 0.0f, 15.0f);

        if (volume != newVolume)
        {
            _dsp.SetFloatParameter(Hv_shields_AudioLib.Parameter.Volume, newVolume);
        }
        GUILayout.EndHorizontal();
        EditorGUI.indentLevel--;
    }