当前位置: 首页>>代码示例>>C#>>正文


C# GameStates.ToString方法代码示例

本文整理汇总了C#中GameStates.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# GameStates.ToString方法的具体用法?C# GameStates.ToString怎么用?C# GameStates.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameStates的用法示例。


在下文中一共展示了GameStates.ToString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetGameState

 public void SetGameState(GameStates newState)
 {
     Debug.Log("Setting GameState :" + newState.ToString());
     if (newState == GameStates.GameOverLoss) {
         RestartGame();
     }
 }
开发者ID:ambitiousgame,项目名称:Ambitious-Game-Hour,代码行数:7,代码来源:Data.cs

示例2: State

        /// <summary>
        /// State constructor
        /// </summary>
        /// <param name="game">Referance to the game</param>
        /// <param name="spriteBatch">Referance to the spriteBatch</param>
        /// <param name="managerId">Unique ID to the manager of this state</param>
        /// <param name="gameStateId">Unique enum under the manager used to identify the state</param>
        protected State(Game game, SpriteBatch spriteBatch, 
            string managerId, GameStates gameStateId)
            : base(game)
        {
            //Add newly created managers to the list (SingleplayerManager, MenuManager etc)
            States.Add(string.Concat(managerId, gameStateId.ToString()), this);

            //Store the managerId for lookup in the dictionary
            _managerId = managerId;

            //Keep a referance to the game and spriteBatch so that sub classes
            //can access them
            _game = game;
            _spriteBatch = spriteBatch;
        }
开发者ID:kimsyversen,项目名称:Jump,代码行数:22,代码来源:State.cs

示例3: RestorePreviousState

    public void RestorePreviousState(GameStates state = GameStates.None) {
        if(_stateStack.Count == 0) throw new Exception("No previous states available");

        // set target state to the previous state if none specified
        if(state == GameStates.None)
            state = (_stateStack.Peek() as BaseGameState).GameState;

        while(_stateStack.Count > 0 && CurrentState.GameState != state) {
            CurrentState.OnExit -= OnExit;
            CurrentState.Dispose();

            CurrentState = (BaseGameState)_stateStack.Pop();
        }

        if(CurrentState == null) throw new Exception("Previous state not found: " + state.ToString());

        Debug.Log("Restored state to " + CurrentState.GameState.ToString());

        CurrentState.OnExit += OnExit;
        CurrentState.EnterState();
    }
开发者ID:jtuttle,项目名称:haven,代码行数:21,代码来源:GameStateMachine.cs

示例4: PopUp

 /// <summary>
 /// When a state (sub-class of this) 
 /// wants a state to pup up, it calls the method PopUp
 /// with the apropriate enum of the state
 /// </summary>
 /// <param name="gameStateId"></param>
 protected void PopUp(GameStates gameStateId)
 {
     ChangeState = States[string.Concat(_managerId, gameStateId.ToString())];
     PopUpState = true;
 }
开发者ID:kimsyversen,项目名称:Jump,代码行数:11,代码来源:State.cs

示例5: GetState

 /// <summary>
 /// Get the state with the specified GameState
 /// </summary>
 /// <param name="gameStateId">GameState id of the state</param>
 /// <returns>Returns the state</returns>
 protected State GetState(GameStates gameStateId)
 {
     return States[string.Concat(_managerId, gameStateId.ToString())];
 }
开发者ID:kimsyversen,项目名称:Jump,代码行数:9,代码来源:State.cs

示例6: ChangeStateTo

 /// <summary>
 /// When a state (sub-class of this) 
 /// wants to change the state, it calls the method ChangeStateTo
 /// with the apropriate enum of the state
 /// </summary>
 /// <param name="gameStateId">Enum identifying the states</param>
 protected void ChangeStateTo(GameStates gameStateId)
 {
     Debug.WriteLine("Changing state to: " + gameStateId.ToString());
     ChangeState = States[string.Concat(_managerId, gameStateId.ToString())];
     PopUpState = false;
 }
开发者ID:kimsyversen,项目名称:Jump,代码行数:12,代码来源:State.cs

示例7: OutputWinMessage

        public void OutputWinMessage(char symbol, GameStates gameState)
        {
            if (InvokeRequired)
            {
                Invoke(new Logik.WinMessageHandler(OutputWinMessage), new object[] { symbol, gameState });
                return;
            }
            if (gameState == GameStates.Unentschieden)
            {
                MessageBox.Show("    " + gameState.ToString() + "   ", gameState.ToString());
            }
            else
            {
                string spielerName = "Gegner";
                if (IsPlayerGegner())
                {
                    spielerName = "Spieler";
                }
                MessageBox.Show(string.Format("Der {0} {1} hat {2}.", spielerName, symbol, gameState), gameState.ToString());
            }

            label1.Location = new Point(37, label1.Location.Y);
            label1.Text = "Klicken Sie zum neustarten irgendwo hin.";
        }
开发者ID:Postremus,项目名称:UniTTT,代码行数:24,代码来源:Form1.cs

示例8: SwitchToReady

 /// <summary>
 /// Игра перешла в стадию "готова начаться"
 /// </summary>
 /// <param name="time"></param>
 void SwitchToReady(int time)
 {
     state = GameStates.Ready;
     times.ready = time;
     Debug.Log("Игра готова: " + state.ToString("g"));
 }
开发者ID:PanCrucian,项目名称:IOL,代码行数:10,代码来源:Game.cs

示例9: SwitchToGameOver

 /// <summary>
 /// Игра перешла в стадию "Конец игры"
 /// </summary>
 /// <param name="time"></param>
 void SwitchToGameOver(int time)
 {
     state = GameStates.GameOver;
     times.gameOver = time;
     Debug.Log("Игра закончилась: " + state.ToString("g"));
     if (OnGameOver != null)
         OnGameOver();
 }
开发者ID:PanCrucian,项目名称:IOL,代码行数:12,代码来源:Game.cs

示例10: SwitchToGame

 /// <summary>
 /// Игра перешла в основную стадию игры
 /// </summary>
 /// <param name="time"></param>
 void SwitchToGame(int time)
 {
     state = GameStates.Game;
     times.start = time;
     Debug.Log("Игра началась: " + state.ToString("g"));
 }
开发者ID:PanCrucian,项目名称:IOL,代码行数:10,代码来源:Game.cs


注:本文中的GameStates.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。