本文整理汇总了C#中IGameState.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# IGameState.Initialize方法的具体用法?C# IGameState.Initialize怎么用?C# IGameState.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGameState
的用法示例。
在下文中一共展示了IGameState.Initialize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SwitchState
internal static void SwitchState(IGameState newstate)
{
if (CurrentState != null) {
CurrentState.Uninitialize();
}
newstate.Initialize();
CurrentState = newstate;
}
示例2: Initialize
public void Initialize()
{
var strikeInfo = _gameObjects["currentStrikeInfo"] as StrikeInfo;
var enableQuestioning = strikeInfo.Quiz != null && strikeInfo.Quiz.Count > 0;
var currentGame = _gameObjects["currentGame"] as Game;
if (currentGame == null) throw new NullReferenceException("currentGame");
var userPlayScenario = GetUserPlayScenario(_gameObjects, enableQuestioning);
var scenario = currentGame.Type == GameTypeEnum.Competition ? GetCompetitionScenario(_gameObjects, userPlayScenario) : userPlayScenario;
_activeState = scenario[0];
_activeState.Initialize();
}
示例3: Play
public bool Play()
{
var looping = _activeState.Loop();
if (!looping)
{
_activeState = _activeState.NextState;
if (_activeState != null)
{
_activeState.Initialize();
looping = true;
}
}
return looping;
}
示例4: Initialize
public void Initialize()
{
gameStates.Clear();
var currentGame = _gameObjects["currentGame"] as Game;
if (currentGame == null) throw new NullReferenceException("currentGame");
IGameState result = null;
if (currentGame.Type == GameTypeEnum.Competition)
{
result = new ShowCompetitionResultGameState() { GameObjects = _gameObjects };
gameStates.Add(result);
}
else
{
result = new ShowTrainingResultGameState() {GameObjects = _gameObjects};
gameStates.Add(result);
}
var play = new PlayGameState() { GameObjects = _gameObjects, NextState = result };
gameStates.Add(play);
var init = new InitGameState() { NextState = play, GameObjects = _gameObjects };
gameStates.Add(init);
var start = new StartingGameState() { GameObjects = _gameObjects, NextState = init };
gameStates.Add(start);
var instruction = new ShowInstructionGameState() {GameObjects = _gameObjects, NextState = start};
gameStates.Add(instruction);
_activeState = instruction;
_activeState.Initialize();
}
示例5: Play
public bool Play()
{
var looping = _activeState.Loop();
if (_activeState.IsCancelled)
{
IsCancelled = true;
}
if (IsCancelled) return false;
if (!looping)
{
_activeState = _activeState.NextState;
if (_activeState != null)
{
_activeState.Initialize();
looping = true;
}
}
return looping;
}
示例6: Initialize
/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize()
{
graphics.PreferredBackBufferWidth = windowWidth;
graphics.PreferredBackBufferHeight = windowHeight;
graphics.ApplyChanges();
currentState = new PreConnectionState(this);
currentState.Initialize();
// call other classes' Initialize methods here
base.Initialize();
}
示例7: ChangeState
public void ChangeState(IGameState state)
{
currentState.Uninitialize();
state.Initialize();
currentState = state;
}