Example #1
0
    // Update method equal to all subclasses
    void Update()
    {
        animStateInfo = animator.GetCurrentAnimatorStateInfo(0);

        switch (status)
        {
        case Status.INACTIVE:
            inactiveIdle();
            break;

        case Status.IDLE:
            fov.checkIsPlayerVisible();
            idle();
            break;

        case Status.WARNED:
            fov.checkIsPlayerVisible();
            warned();
            break;

            //case Status.DEAD  this event is handled in 'hurt' method
        }

        animator.SetFloat(animVarSpeed, agent.velocity.magnitude);      // updates the Speed variable of the animator
    }