Ejemplo n.º 1
0
    protected virtual void Awake()
    {
        startTimeOfProgram = System.DateTime.Now.ToString("yyyy MM dd HH:mm:ss");

        GetBody();
        GetTrackedSpace();
        GetSimulatedHead();

        GetSimulationManager();
        SetReferenceForSimulationManager();
        simulationManager.Initialize();

        GetRedirector();
        GetResetter();
        GetResetTrigger();
        GetTrailDrawer();

        GetSimulatedWalker();
        GetKeyboardController();
        GetSnapshotGenerator();
        GetStatisticsLogger();
        GetBodyHeadFollower();
        SetReferenceForRedirector();
        SetReferenceForResetter();
        SetReferenceForResetTrigger();
        SetBodyReferenceForResetTrigger();
        SetReferenceForTrailDrawer();

        SetReferenceForSimulatedWalker();
        SetReferenceForKeyboardController();
        SetReferenceForSnapshotGenerator();
        SetReferenceForStatisticsLogger();
        SetReferenceForBodyHeadFollower();

        // The rule is to have RedirectionManager call all "Awake"-like functions that rely on RedirectionManager as an "Initialize" call.
        resetTrigger.Initialize();
        // Resetter needs ResetTrigger to be initialized before initializing itself
        if (resetter != null)
        {
            resetter.Initialize();
        }

        if (runInTestMode)
        {
            MOVEMENT_CONTROLLER = MovementController.AutoPilot;
        }
        if (MOVEMENT_CONTROLLER != MovementController.Tracker)
        {
            headTransform = simulatedHead;
        }


        // For some reason, the toolkit does not do this already so I added it
        if (MOVEMENT_CONTROLLER == MovementController.Keyboard)
        {
            keyboardController.GetComponent <Camera>().enabled = true;
        }
    }
 private void Initialize()
 {
     playerManager.Initialize();
     simulationManager.Initialize();
     worldStateManager.Initialize();
     worldRequestQueueManager.Initialize();
     timeManager.Initialize();
     environmentManager.Initialize();
     disasterManager.Initialize();
 }
Ejemplo n.º 3
0
    void StartNewSimulation() //i.e. new game.
    {
        simMan.Initialize(1);
        popMan.Initialize();
        buildMan.Initialize();
        uiMan.Initialize();
        Grid.grid.Initialize();
        envMan.Initialize();

        currentGameState            = GameState.gameplayStage1;
        SimulationManager.onNewDay += FinishNight;
    }
Ejemplo n.º 4
0
    void Awake()
    {
        startTimeOfProgram = System.DateTime.Now.ToString("yyyy MM dd HH:mm:ss");

        GetBody();
        GetTrackedSpace();
        GetSimulatedHead();

        GetSimulationManager();
        SetReferenceForSimulationManager();
        simulationManager.Initialize();

        GetRedirector();
        GetResetter();
        GetResetTrigger();
        GetTrailDrawer();

        GetSimulatedWalker();
        GetKeyboardController();
        GetSnapshotGenerator();
        GetStatisticsLogger();
        GetBodyHeadFollower();
        SetReferenceForRedirector();
        SetReferenceForResetter();
        SetReferenceForResetTrigger();
        SetBodyReferenceForResetTrigger();
        SetReferenceForTrailDrawer();

        SetReferenceForSimulatedWalker();
        SetReferenceForKeyboardController();
        SetReferenceForSnapshotGenerator();
        SetReferenceForStatisticsLogger();
        SetReferenceForBodyHeadFollower();

        // The rule is to have RedirectionManager call all "Awake"-like functions
        // that rely on RedirectionManager as an "Initialize" call.
        resetTrigger.Initialize();
        // Resetter needs ResetTrigger to be initialized before initializing itself
        if (resetter != null)
        {
            resetter.Initialize();
        }

        if (runInTestMode)
        {
            MOVEMENT_CONTROLLER = MovementController.AutoPilot;
        }
        if (MOVEMENT_CONTROLLER != MovementController.Tracker)
        {
            headTransform = simulatedHead;
        }
    }
        private void InitializeManagers()
        {
            playerManager      = new PlayerManager(this);
            simulationManager  = new SimulationManager(this);
            timeManager        = new Time.TimeManager(this);
            worldStateManager  = new WorldStateManager(this);
            environmentManager = new Environment.EnvironmentManager(this);
            disasterManager    = new Environment.DisasterManager(this);
#if DEBUG
            debugManager = new Debugging.DebugManager(this);
#endif

            playerManager.Initialize();
            simulationManager.Initialize();
            timeManager.Initialize();
            worldStateManager.Initialize();
            environmentManager.Initialize();
            disasterManager.Initialize();
#if DEBUG
            debugManager.Initialize();
#endif
        }
Ejemplo n.º 6
0
        private void DrawDomainField()
        {
            // =========================
            // ======== DOMAIN =========
            // =========================

            // Check if changed
            EditorGUI.BeginChangeCheck();
            // Domain File
            EditorGUILayout.BeginVertical();
            GUILayout.Label("Domain File", EditorStyles.boldLabel);
            GUILayout.Space(5);
            // Draw domain filed
            EditorGUILayout.BeginHorizontal();
            var domain = (TextAsset)EditorGUILayout.ObjectField(_simulationManager.domain, typeof(TextAsset), false);

            if (GUILayout.Button("Clear"))
            {
                domain = null;
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(_simulationManager, "Domain File Change");
                _simulationManager.domain = domain;

                if (domain != null)
                {
                    _simulationManager.Initialize();
                }
                else
                {
                    _simulationManager.Reset();
                }
                // save asset
                EditorUtility.SetDirty(_simulationManager);
            }
        }