Exemple #1
0
        public void ResetAnimation()
        {
            if (!isInitialized)
            {
                Initialize();
            }

            lastLook = EnemyLook.Front;
            UpdateAnimation();
            isUpdating = true;
        }
Exemple #2
0
        private void UpdateAnimation()
        {
            var look = lastLook;

            while (look == lastLook)
            {
                look = (EnemyLook)Random.Range(0, 4) + 1;
            }

            lastLook = look;

            animator.SetTrigger(look.ToString().ToLower());

            updateTime = Time.time + Random.Range(MinAnimationTime, MaxAnimationTime);
        }
Exemple #3
0
    //Target targetE;


    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        GameObject enemy = GameObject.FindGameObjectWithTag("Player");

        //if (enemy != null)
        //{

        //        enemy.GetComponent<Target>().TakeDamage(damage);


        //}
        player    = GameObject.FindGameObjectWithTag("Player").transform;
        rb        = animator.GetComponent <Rigidbody>();
        enemyLook = animator.GetComponent <EnemyLook>();

        //targetE = animator.GetComponent<Target>();
    }