override public void OnStateMachineEnter(Animator animator, int stateMachinePathHash)
 {
     animator.SetBool(playSpecialHash, false);
     if (!minifigController)
     {
         minifigController = animator.GetComponent <MinifigController>();
     }
 }
Пример #2
0
        void Awake()
        {
            // Get information about enemy and player.
            player   = GameObject.FindWithTag("Player").transform;
            animator = GetComponent <Animator>();
            minifig  = GetComponent <Unity.LEGO.Minifig.MinifigController>();

            if (hidehealthbar)
            {
                healthbar.gameObject.SetActive(false);
            }
            else
            {
                healthbar.value = health / maxhealth;
            }

            // Make enemy alive.
            dead = false;

            AnimationClip[] clips = animator.runtimeAnimatorController.animationClips;
            foreach (AnimationClip clip in clips)
            {
                switch (clip.name)
                {
                case "OneHandedReverseSwordSwingAnimation":
                    swordReverseSwipeDuration = clip.length;
                    break;

                case "OneHandedSwordSwingAnimation":
                    swordSwipeDuration = clip.length;
                    break;
                }
            }

            audioSource = GetComponent <AudioSource>();
        }