public override void EnterState()
        {
            base.EnterState();
            timer = 4.0f;

            if (controller.AnturaHappiness > 0.95f)
            {
                state = AnturaAnimationStates.dancing;
            }
            else
            {
                float p = UnityEngine.Random.value * controller.AnturaHappiness;

                if (p < 0.25f)
                {
                    state = AnturaAnimationStates.digging;
                }
                else if (p < 0.45f)
                {
                    state = AnturaAnimationStates.sheeping;
                }
                else if (p < 0.7f)
                {
                    state = AnturaAnimationStates.bellyUp;
                }
                else
                {
                    state = AnturaAnimationStates.dancing;
                }
            }
        }
Beispiel #2
0
    public void DoSniff()
    {
        if (State != AnturaAnimationStates.idle)
        {
            if (!hasToGoBackState)
            {
                backState = State;
            }
            State            = AnturaAnimationStates.idle;
            hasToGoBackState = true;
        }

        animator.SetTrigger("doSniff");
    }
Beispiel #3
0
    public void OnJumpStart()
    {
        if (State != AnturaAnimationStates.idle &&
            State != AnturaAnimationStates.walking)
        {
            if (!hasToGoBackState)
            {
                backState = State;
            }
            State            = AnturaAnimationStates.idle;
            hasToGoBackState = true;
        }

        animator.SetBool("jumping", true);
        animator.SetBool("falling", true);
    }
Beispiel #4
0
        public void DoSniff(System.Action onSniffEnded = null, System.Action onSniffStarted = null)
        {
            onSniffEndedCallback   = onSniffEnded;
            onSniffStartedCallback = onSniffStarted;
            if (State != AnturaAnimationStates.idle)
            {
                if (!hasToGoBackState)
                {
                    backState = State;
                }
                State            = AnturaAnimationStates.idle;
                hasToGoBackState = true;
            }

            animator.SetTrigger("doSniff");
        }
Beispiel #5
0
    public void DoSpit(bool openMouth)
    {
        if (State != AnturaAnimationStates.idle)
        {
            if (!hasToGoBackState)
            {
                backState = State;
            }
            State            = AnturaAnimationStates.idle;
            hasToGoBackState = true;
        }

        if (openMouth)
        {
            animator.SetTrigger("doSpitOpen");
        }
        else
        {
            animator.SetTrigger("doSpitClosed");
        }
    }
Beispiel #6
0
    void OnStateChanged(AnturaAnimationStates oldState, AnturaAnimationStates newState)
    {
        if (newState != AnturaAnimationStates.walking)
        {
            animator.SetBool("slipping", false);
        }

        animator.SetBool("idle", false);
        animator.SetBool("walking", false);
        animator.SetBool("sitting", false);
        animator.SetBool("sleeping", false);
        animator.SetBool("sheeping", false);
        animator.SetBool("sucking", false);

        animator.SetBool("bellyingUp", false);
        animator.SetBool("digging", false);
        animator.SetBool("dancing", false);
        animator.SetBool("bitingTail", false);

        switch (newState)
        {
        case AnturaAnimationStates.idle:
            animator.SetBool("idle", true);
            break;

        case AnturaAnimationStates.walking:
            animator.SetBool("walking", true);
            break;

        case AnturaAnimationStates.sitting:
            animator.SetBool("sitting", true);
            break;

        case AnturaAnimationStates.sleeping:
            animator.SetBool("sleeping", true);
            break;

        case AnturaAnimationStates.sheeping:
            animator.SetBool("sheeping", true);
            break;

        case AnturaAnimationStates.sucking:
            animator.SetBool("sucking", true);
            break;

        case AnturaAnimationStates.bellyUp:
            animator.SetBool("bellyingUp", true);
            break;

        case AnturaAnimationStates.bitingTail:
            animator.SetBool("bitingTail", true);
            break;

        case AnturaAnimationStates.dancing:
            animator.SetBool("dancing", true);
            break;

        case AnturaAnimationStates.digging:
            animator.SetBool("digging", true);
            break;

        default:
            // No specific visual behaviour for this state
            break;
        }
    }