Example #1
0
    public void StartGame()
    {
        // Spawn the player offscreen. SetPlayerDefaults locks it and prevents movement.
        // Player Object remains in the persistent scene, so we don't need to care
        // about what happens between scene loads...
        {
            m_goPlayerObjectReference = GameInstance.Instantiate(m_goPlayerPrefab, new Vector3(100, 100, 0), Quaternion.identity);
            GAssert.Assert(null != m_goPlayerObjectReference, "Unable to instantiate Player Object");
            m_gcPlayerState = m_goPlayerObjectReference.GetComponent <PlayerState>();
            GAssert.Assert(null != m_gcPlayerState, "Unable to get Player State");
            m_gcPlayerController = m_goPlayerObjectReference.GetComponent <PlayerController>();
            GAssert.Assert(null != m_gcPlayerController, "Unable to get Player Controller");
            m_gcPlayerInventory = m_goPlayerObjectReference.GetComponent <PlayerInventory>();
            GAssert.Assert(null != m_gcPlayerInventory, "Unable to get Player Inventory!");
        }

        // Set Game Defaults
        {
            Messenger.ClearAll();
            TimerManager.SetDefaults(1.0f, 1.0f);
            m_gcPlayerInventory.SetDefaults();
            m_gcPlayerState.SetDefaults();
            m_gcGameCamera.SetDefaults();
            GameGlobals.SetDefaults();

            // Put the player in the correct position!
            // GNTODO: This needs to be loaded!
            //
            {
                // teleportPlayerToSpawnPoint...
            }
        }
    }
Example #2
0
    private void StartGame()
    {
        // Spawn the player offscreen. SetPlayerDefaults locks it and prevents movement.
        // Player Object remains in the persistent scene, so we don't need to care
        // about what happens between scene loads...
        {
            m_goPlayerObjectReference = GameInstance.Instantiate(m_goPlayerPrefab, new Vector3(100, 100, 0), Quaternion.identity);
            GAssert.Assert(null != m_goPlayerObjectReference, "Unable to instantiate Player Object");
            m_gcPlayerState = m_goPlayerObjectReference.GetComponent <PlayerState>();
            GAssert.Assert(null != m_gcPlayerState, "Unable to get Player State");
            m_gcPlayerController = m_goPlayerObjectReference.GetComponent <PlayerController>();
            GAssert.Assert(null != m_gcPlayerController, "Unable to get Player Controller");
            m_gcPlayerInventory = m_goPlayerObjectReference.GetComponent <PlayerInventory>();
            GAssert.Assert(null != m_gcPlayerInventory, "Unable to get Player Inventory!");
        }

        // Set Game Defaults
        {
            Messenger.ClearAll();
            TimerManager.SetDefaults(1.0f, 1.0f);
            m_gcPlayerInventory.SetDefaults();
            m_gcPlayerState.SetDefaults();
            m_gcGameCamera.SetDefaults();
            GameGlobals.SetDefaults();
            m_gcGameHud.SetDefaults();
            m_gcPauseScreen.SetDefaults();
            m_gcMainMenu_Cecconoid.SetDefaults();
            m_gcGameOverScreen.SetDefaults();
            m_gcCompletionSequence.SetDefaults();
#if GDEBUG
            m_gcDevMenu.SetDefaults();
#endif

            Messenger.Invoke(Types.s_sHUD_Hide);
        }
    }