本文整理汇总了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();
}
}
示例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;
}
示例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();
}
示例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;
}
示例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())];
}
示例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;
}
示例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.";
}
示例8: SwitchToReady
/// <summary>
/// Игра перешла в стадию "готова начаться"
/// </summary>
/// <param name="time"></param>
void SwitchToReady(int time)
{
state = GameStates.Ready;
times.ready = time;
Debug.Log("Игра готова: " + state.ToString("g"));
}
示例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();
}
示例10: SwitchToGame
/// <summary>
/// Игра перешла в основную стадию игры
/// </summary>
/// <param name="time"></param>
void SwitchToGame(int time)
{
state = GameStates.Game;
times.start = time;
Debug.Log("Игра началась: " + state.ToString("g"));
}