コード例 #1
0
 private void EndGame()
 {
     Debug.Log("Game is over");
     _gameOverUI.Show();
     GameIsOver = true;
     BallGameSaveSystem.Save();
 }
コード例 #2
0
        private void SetupDebugConsole()
        {
            // Adds the save to the 'save' tab of the log emails. This also supports binary data, if need be.
            DebugConsole.SaveFileProvider += () => new[]
            {
                new SaveFileData("save.txt", BallGameSaveSystem.AsString(), SaveFileDataType.TEXT),
                new SaveFileData("data.json", "{\"health\": 42, \"player_name\": \"Player17\"}", SaveFileDataType.JSON)
            };

            // Use this to add information to the 'info' tab of the log emails.
            DebugConsole.GameInfoProvider += () => new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("Current level", Level.ToString()),
                new KeyValuePair <string, string>("Turns left", TurnsLeft.ToString()),
                new KeyValuePair <string, string>("Is game over?", GameIsOver.ToString())
            };

            // This shows how you could pre-process commands being entered into the console if you want to be able to
            // do something quite different with the input.
            // In this case, we handle all commands that start with a dash, and allow all the rest to be handled as normal.
            CommandHandlers.BeforeCommandParsedHook += input =>
            {
                if (!input.StartsWith("-"))
                {
                    return(false);        // this is not the command we are looking for - allow the normal behaviour to happen
                }
                Debug.Log("Dash prefixed command entered: " + input.Substring(1));
                return(true);        // we've handled it, don't allow the normal command system to run
            };
        }
コード例 #3
0
        private void SetupDebugConsole()
        {
            // Adds the save to the 'save' tab of the log emails. This also supports binary data, if need be.
            DebugConsole.SaveFileProvider += () => new[]
            {
                new SaveFileData("save.txt", BallGameSaveSystem.AsString(), SaveFileDataType.TEXT),
                new SaveFileData("data.json", "{\"health\": 42, \"player_name\": \"Player17\"}", SaveFileDataType.JSON)
            };

            // Use this to add information to the 'info' tab of the log emails.
            DebugConsole.GameInfoProvider += () => new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("Current level", Level.ToString()),
                new KeyValuePair <string, string>("Turns left", TurnsLeft.ToString()),
                new KeyValuePair <string, string>("Is game over?", GameIsOver.ToString())
            };
        }