Пример #1
0
        public IEnumerator AttackAudioPlayNoDamageTest()
        {
            game = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Game"));
            yield return(new WaitForSecondsRealtime(1f));

            audio = GameObject.Find("SwordSlot").GetComponent <AttackAudio>();
            audio.PLayNoDamage();
            Assert.IsTrue(audio.Source.clip.name == "ВзмахМечом");
            GameObject.Destroy(game);
        }
Пример #2
0
    public void PlayAttackAnimation()
    {
        audio.PLayNoDamage();
        var curState = playerAnim.GetCurrentAnimatorStateInfo(0);

        if (curState.IsName("UpMove") || curState.IsName("UpIdle"))
        {
            animator.SetTrigger("UpAttack");
        }
        else if (curState.IsName("LeftMove") || curState.IsName("LeftIdle"))
        {
            animator.SetTrigger("LeftAttack");
        }
        else if (curState.IsName("DownMove") || curState.IsName("DownIdle"))
        {
            animator.SetTrigger("DownAttack");
        }
        else if (curState.IsName("RightMove") || curState.IsName("RightIdle"))
        {
            animator.SetTrigger("RightAttack");
        }
    }