Exemplo n.º 1
0
 private void OnSimulationConcluded()
 {
     Physics.autoSimulation = true;
     _currentSpace          = Timespace.FUTURE;
     SetFutureInteractions();
     ToggleCulling();
 }
Exemplo n.º 2
0
 private void OnGoBackConcluded()
 {
     if (_futureContainer != null)
     {
         Destroy(_futureContainer);
     }
     SetPastInteractions();
     _currentSpace = Timespace.PAST;
     ToggleCulling();
 }
Exemplo n.º 3
0
    public void ChangeState(Timespace state, bool playTransition = true)
    {
        if (playTransition)
        {
            TransitionController.Instance.StartTimeTransition();
        }

        switch (state)
        {
        case Timespace.FUTURE:
            Simulate();
            break;

        case Timespace.PAST:
            _currentSpace = Timespace.GOBACK;
            break;
        }

        _stateChangeTime = Time.realtimeSinceStartup;
    }
Exemplo n.º 4
0
    private void Simulate()
    {
        PastRigidbodies = PastContainer.GetComponentsInChildren <Rigidbody>();

        foreach (var pastRigidbody in PastRigidbodies)
        {
            pastRigidbody.velocity        = Vector3.zero;
            pastRigidbody.angularVelocity = Vector3.zero;
        }

        _futureContainer      = Instantiate(PastContainer);
        _futureActionCommands = _futureContainer.GetComponentsInChildren <ActionCommand>();
        _futureContainer.name = "FutureContainer";
        Utils.SetLayerRecursively(_futureContainer, _futureLayer);

        _currentSpace = Timespace.SIMULATION;
        foreach (var futureActionCommand in _futureActionCommands)
        {
            futureActionCommand.OnCommand();
        }

        Physics.autoSimulation = false;
        SetSimulationInteractions();
    }