Exemplo n.º 1
0
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        m_isExiting = false;

        Debug.Log("Entering execute state");
        base.OnStateEnter(animator, stateInfo, layerIndex);

        // If is the master client, instantiate a NetExecuteState to all clients upon entering
        if (PhotonNetwork.isMasterClient)
        {
            m_netExecuteStateObject = PhotonNetwork.Instantiate("CombatStateMachine/NetExecuteState", Vector3.zero, Quaternion.identity, 0);
            PhotonNetwork.Spawn(m_netExecuteStateObject.GetComponent<PhotonView>());
            m_netExecuteState = m_netExecuteStateObject.GetComponent<NetExecuteState>();
        }
    }
Exemplo n.º 2
0
    // 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) {
    //
    //}

    // OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here
    //override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateIK is called right after Animator.OnAnimatorIK(). Code that sets up animation IK (inverse kinematics) should be implemented here.
    //override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    public override void ExitState()
    {
        m_isExiting = true;

        if (m_netExecuteStateObject != null)
        {
            // TODO: Change back to just calling Destroy when that is fixed
            PhotonNetwork.Destroy(m_netExecuteStateObject);
            Destroy(m_netExecuteStateObject);
        }
        
        m_netExecuteStateObject = null;
        m_netExecuteState = null;
    }