예제 #1
0
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        JengaStateMachine sm = animator.GetComponent <JengaStateMachine>();

        if (sm == null)
        {
            return;
        }

        if (stateInfo.IsName("Playing"))
        {
            //Debug.Log("Enter: Start Turn");
            sm.disableHandler();
        }
    }
예제 #2
0
    // 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)
    {
        //Debug.Log("Enter");
        JengaStateMachine sm = animator.GetComponent <JengaStateMachine>();

        if (sm == null)
        {
            return;
        }

        if (stateInfo.IsName("Playing"))
        {
            //Debug.Log("Enter: Start Turn");
            sm.startTurn();
        }

        if (stateInfo.IsName("End Turn"))
        {
            //Debug.Log("Enter: End Turn");
            sm.endTurn();
        }

        if (stateInfo.IsName("Lose"))
        {
            //Debug.Log("Enter: End Turn");
            sm.lose();
        }

        if (stateInfo.IsName("Win"))
        {
            //Debug.Log("Enter: End Turn");
            sm.win();
        }

        if (stateInfo.IsName("Viewing"))
        {
            //Debug.Log("Enter: Start Turn");
            sm.disableHandler();
        }

        if (stateInfo.IsName("Block Fallen"))
        {
            animator.ResetTrigger("Block Falls");
        }
    }