예제 #1
0
    /// <summary>
    /// Load the specified state.
    /// </summary>
    /// <param name="newState">The name of the state the state that should be loaded.</param>
    /// <param name="onLoadDone">Callback to be executed once scene switching is done</param>
    public void GoToState(States newState, System.Action onLoadDone = null)
    {
        // TODO: not working because the wheelchair is overwriting the position but needed to reset the user
        //WheelchairStateManager.Instance.transform.position = Vector3.zero;

        // keep motor disabled at all times, only HUD can send motor commands which is set in the DelegateAfterHudLoad
        clientLogic.unityClient.EnableMotor(false);
        _lastSwitch = Time.time;
        switch (newState)
        {
        //case States.Construct:
        //    transitionManager.StartTransition(false);
        //    additiveSceneManager.ChangeScene(Scenes.CONSTRUCT, null, null, DelegateBeforeConstructLoad, () =>
        //    {
        //        DelegateAfterConstructLoad();
        //        onLoadDone?.Invoke();
        //    });
        //    currentState = States.Construct;
        //    break;
        case States.HUD:
            transitionManager.StartTransition(true);
            additiveSceneManager.ChangeScene(Scenes.HUD, null, null, DelegateBeforeHudLoad, () =>
            {
                DelegateAfterHudLoad();
                onLoadDone?.Invoke();
            });
            currentState = States.HUD;
            break;

        case States.Training:
            transitionManager.StartTransition(true);
            additiveSceneManager.ChangeScene(Scenes.TRAINING, null, null, DelegateBeforeTrainingLoad, () =>
            {
                DelegateAfterTrainingLoad();
                onLoadDone?.Invoke();
            });
            currentState = States.Training;
            break;

        default:
            Debug.LogWarning("Unhandled State: Please specify the next State after " + currentState);
            break;
        }
        visitedStates.Add(currentState);
    }
예제 #2
0
    /// <summary>
    /// Public method initiating state transition.
    /// Change from current state to next state (fixed order).
    /// </summary>
    public void GoToNextState()
    {
        switch (currentState)
        {
        case States.HUD:
            transitionManager.StartTransition(false);
            additiveSceneManager.ChangeScene(Scenes.CONSTRUCT, null, null, DelegateBeforeConstructLoad, DelegateAfterConstructLoad);
            currentState = States.Construct;
            break;

        case States.Construct:
            transitionManager.StartTransition(true);
            additiveSceneManager.ChangeScene(Scenes.HUD, null, DelegateOnConstructUnload, null, null);
            currentState = States.HUD;
            break;

        default:
            Debug.LogWarning("Unhandled State: Please specify the next State after " + currentState);
            break;
        }
    }
예제 #3
0
    /// <summary>
    /// Set reference to instances.
    /// Load construct as initial state.
    /// </summary>
    void Start()
    {
        constructFXManager   = GameObject.FindGameObjectWithTag("ConstructFXManager").GetComponent <ConstructFXManager>();
        additiveSceneManager = GameObject.FindGameObjectWithTag("AdditiveSceneManager").GetComponent <AdditiveSceneManager>();
        transitionManager    = GameObject.FindGameObjectWithTag("TransitionManager").GetComponent <TransitionManager>();

        leftSenseGlove  = GameObject.FindGameObjectWithTag("SenseGloveLeft");
        rightSenseGlove = GameObject.FindGameObjectWithTag("SenseGloveRight");
        leftSenseGlove.SetActive(false);
        rightSenseGlove.SetActive(false);
        additiveSceneManager.ChangeScene(Scenes.CONSTRUCT, null, null, DelegateBeforeConstructLoad, DelegateAfterConstructLoad);
        currentState = States.Construct;
    }
예제 #4
0
    /// <summary>
    /// Set reference to instances.
    /// Load construct as initial state.
    /// </summary>
    void Start()
    {
        constructFXManager   = GameObject.FindGameObjectWithTag("ConstructFXManager").GetComponent <ConstructFXManager>();
        additiveSceneManager = GameObject.FindGameObjectWithTag("AdditiveSceneManager").GetComponent <AdditiveSceneManager>();
        transitionManager    = GameObject.FindGameObjectWithTag("TransitionManager").GetComponent <TransitionManager>();

        leftSenseGlove  = GameObject.FindGameObjectWithTag("SenseGloveLeft");
        rightSenseGlove = GameObject.FindGameObjectWithTag("SenseGloveRight");
        leftSenseGlove.SetActive(false);
        rightSenseGlove.SetActive(false);

        bioIks = FindObjectsOfType <BioIK.BioIK>();

        //additiveSceneManager.ChangeScene(Scenes.CONSTRUCT, null, null, DelegateBeforeConstructLoad, DelegateAfterConstructLoad);
        //currentState = States.Construct;
        additiveSceneManager.ChangeScene(Scenes.TRAINING, null, null, null, DelegateAfterTrainingLoad);
        currentState = States.Training;
        visitedStates.Add(States.Training);
    }