Exemple #1
0
        public void OnGameStart()
        {
            AudioManager.PlayTrigger("game_start");

            if (!Env.IsSandbox)
            {
                Env.Console.ExecuteString("map Canyon");
            }

            GameApp = Application.Instantiate <SydewinderApp>();

            // Initialize Highscore with file name.
            Highscore.InitializeFromFile(HIGHSCORE_URL);

            GameApp.GameOver += showHighscore =>
            {
                // Reset field of view to ehance 3D look.
                Camera.FieldOfView = 60f;

                UI.MainMenu.SetInactive();
                if (showHighscore)
                {
                    UI.MainMenu.SetupHighscoreMenuPerspective();
                }
                else
                {
                    UI.MainMenu.SetupMainMenuPerspective();
                }
            };

            InitializeMainMenu();
        }
Exemple #2
0
        public SydewinderApp()
        {
            AudioManager.PlayTrigger("game_start");

            GameFramework.RegisterForUpdate(this);
            Instance = this;

            // Initialize highscore functionality.
            _gameData = new GameData();

            // _Cry3DEngine_cs_SWIGTYPE_p_ITimeOfDay.SetTime won't work - therefore use console to set time to 7 am.
            Engine.Console.ExecuteString("e_TimeOfDay 24");

            // We are in space, so use (almost) zero gravity (zero gravity would disable physics)
            Engine.Console.ExecuteString("p_gravity_z 0.001");

            // Hook on to Key input.
            Input.OnKey += Input_OnKey;

            _totalGameTime = 0;
            State          = GameState.Finished;

            Camera.Position         = new Vector3(145f, 635f, 70f);
            Camera.ForwardDirection = new Vector3(-1f, 0f, 0f);

            // Initialize Highscore with file name.
            Highscore.InitializeFromFile(HIGHSCORE_URL);

            GameOver += showHighscore =>
            {
                // Reset field of view to ehance 3D look.
                Camera.FieldOfView = 60f;

                UI.MainMenu.SetInactive();
                if (showHighscore)
                {
                    UI.MainMenu.SetupHighscoreMenuPerspective();
                }
                else
                {
                    UI.MainMenu.SetupMainMenuPerspective();
                }
            };

            InitializeMainMenu();
        }