コード例 #1
0
    public void StartState()
    {
        // Reset Variables
        currentAction = LeavingActions.None;
        stateMachine.taskDestination         = null;
        stateMachine.taskDestinationPosition = Vector3.zero;
        exitPoint = null;

        EjectEquippedItem();
    }
コード例 #2
0
    public virtual void UpdateActions()
    {
        switch (currentAction)
        {
        case LeavingActions.None:
        {
            bool result = SetupDestination();

            if (result)
            {
                stateMachine.navMeshAgent.SetDestination(stateMachine.taskDestination.position);

                currentAction = LeavingActions.Moving;
            }

            break;
        }

        case LeavingActions.Moving:
        {
            if (stateMachine.navMeshAgent.remainingDistance < 2.0f)
            {
                currentAction = LeavingActions.Bye;
            }
            break;
        }

        case LeavingActions.Bye:
        {
            //stateMachine.agent.ResetPath();

            if (stateMachine.IsStateMachineActive())
            {
                if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name != "MainMenu")
                {
                    stateMachine.gameManager.RemoveCustomer(stateMachine.transform);
                }
            }

            // Stop statemachine from ticking... it's okay sweet prince, things will be okay...
            stateMachine.DisableStateMachine();

            // Shhhhhhh... you're going to a better place now
            Object.DestroyImmediate(stateMachine.gameObject);

            break;
        }
        }
    }