Beispiel #1
0
 IEnumerator waitToPlaceHydrant()
 {
     for (int i = 0; i < 15; i++)
     {
         yield return(null);
     }
     audio_source.Play();
     transform.rotation      = player.transform.rotation;
     transform.localPosition = new Vector3(0, 0.0f, 1.5f);
     transform.parent        = null;
     HydrantPlaced           = true;
     player.equipHose();
 }
    // 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)
    {
        Debug.Log("State Exit:" + stateInfo.shortNameHash);
        Debug.Log("StateAxeSwing: " + Animator.StringToHash("AxeSwing"));
        Debug.Log("StateAxePoweredUpSwing: " + Animator.StringToHash("AxeSwingPoweredUp"));
        // myAxe.canSwing = false;


        if (stateInfo.shortNameHash == Animator.StringToHash("AxeSwing") || stateInfo.shortNameHash == Animator.StringToHash("AxeSwingPoweredUp"))
        {
            Debug.Log("Exit state!");
            animator.SetInteger("AxePower", 0);
            NewCharacterController player = animator.gameObject.GetComponent <NewCharacterController>();
            Axe axeRef = player.Axe.GetComponent <Axe>();
            axeRef.canHit = false;
            player.equipHose();
        }
    }