本文整理汇总了C#中GameStateManager类的典型用法代码示例。如果您正苦于以下问题:C# GameStateManager类的具体用法?C# GameStateManager怎么用?C# GameStateManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GameStateManager类属于命名空间,在下文中一共展示了GameStateManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoseState
public LoseState(DwarfGame game, GameStateManager stateManager, PlayState play)
: base(game, "EconomyState", stateManager)
{
Input = new InputManager();
PlayState = play;
EnableScreensaver = false;
}
示例2: OnNext
public override void OnNext(GameStateManager value)
{
if (CurrentState == GameState.GamePause)
{
}
}
示例3: Start
/// <summary>
/// Start the Birb Client.
/// </summary>
/// <returns>Nothing right now.</returns>
IEnumerator Start()
{
gameStateManager = GetComponent<GameStateManager>();
Uri server = new Uri("ws://birb.herokuapp.com");
Uri localhost = new Uri("ws://localhost:5000");
socket = new WebSocket(server);
callbacks = new Dictionary<BirbMessageCode, Callback>();
yield return StartCoroutine(socket.Connect());
int i = 0;
// Testing
//RunUnitTests();
while (true)
{
string reply = socket.RecvString();
if (reply != null)
{
Debug.Log("Received: " + reply);
Process(reply);
}
if (socket.Error != null)
{
Debug.LogError("Error: " + socket.Error);
break;
}
yield return 0;
}
socket.Close();
}
示例4: InitializeServer
public void InitializeServer()
{
gameStateManager = new GameStateManager();
//string ip = "147.87.243.27";
serverConfig = new NetPeerConfiguration("pacman");
//serverConfig.LocalAddress = IPAddress.Parse(ip);
serverConfig.Port = 666;
try
{
server = new NetServer(serverConfig);
server.Start();
networkManager = new ServerNetworkManager(server);
WriteToLog("Server wurde gestartet...");
}
catch (Exception)
{
WriteToLog("Fehler! Server nicht gestartet...");
}
//networkManager = new NetworkManager(server);
gameTime = new ServerGameTime();
inputQueue = new SortedSet<Command>(new MovementComparer());
}
示例5: SnakeGame
public SnakeGame()
{
Graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
_gameContentManager = new GameContentManager(Content);
_gameStateManager = new GameStateManager(this, _gameContentManager);
}
示例6: Game1
public Game1()
{
graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 1366;
graphics.PreferredBackBufferHeight = 768;
Content.RootDirectory = "Content";
sb = new SpriteBatch(GraphicsDevice);
input = new InputHandler(this);
this.Components.Add(input);
celAnimationManager = new CelAnimationManager(this);
this.Components.Add(celAnimationManager);
GameManager = new GameStateManager(this);
PlayingState = new PlayingState(this);
PausedState = new PausedState(this);
TitleState = new TitleIntroState(this);
StartMenuState = new StartMenuState(this);
EndState = new EndState(this);
GameManager.ChangeState(TitleState.Value);
//GameManager.ChangeState(PlayingState.Value);
}
示例7: MainMenuState
public MainMenuState(DwarfGame game, GameStateManager stateManager)
: base(game, "MainMenuState", stateManager)
{
ResourceLibrary library = new ResourceLibrary();
IsGameRunning = false;
MaintainState = false;
}
示例8: StartState
public StartState(GameStateManager gameManager)
{
manager = gameManager;
manager.score = 0;
manager.gameLevel = 1;
manager.PlaySound(manager.bgm);
}
示例9: InitialState
public void InitialState()
{
GameStateManager gameStateManager = new GameStateManager();
//Start at GameMenu
Assert.That(gameStateManager.isGameStateEqual(gameStateManager.getGameMenuState()));
}
示例10: Start
public void Start()
{
//Grab mainObject prefab to access managers effectively
mainObject = GameObject.FindGameObjectsWithTag("MainObject")[0];
if (GameObject.FindGameObjectsWithTag("MainObject").Length > 1)
{
GameObject[] mainObjectList = GameObject.FindGameObjectsWithTag("MainObject");
for (int i = 0; i < mainObjectList.Length; ++i)
{
if (mainObjectList[i].GetComponent<GameStateManager>().objectSaved)
mainObject = mainObjectList[i];
}
}
// Notice, these are attached to the MainObject
gameStateManagerRef = mainObject.GetComponent<GameStateManager>();
animationManagerRef = gameStateManagerRef.GetAnimationManager();
inputManagerRef = gameStateManagerRef.GetInputManager();
worldCollisionRef = gameStateManagerRef.GetWorldCollision();
// This script is attached to the player, so we use 'gameObject' here
controllerRef = gameObject.GetComponent<TWCharacterController>();
paperObject = GameObject.FindGameObjectWithTag("background");
}
示例11: BuildLevel
public void BuildLevel(ref GameStateManager gamestatemanager, string path)
{
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(path);
XPathNavigator navigator = xmlDocument.CreateNavigator();
XPathExpression xpath = navigator.Compile("/Level/Structure/Layer");
XPathNodeIterator iterator = navigator.Select(xpath);
Dictionary<string, Queue<string>> dependencyMap = new Dictionary<string,Queue<string>>();
try
{
while(iterator.MoveNext())
{
XPathNavigator element = iterator.Current;
LoadLayer(element, ref dependencyMap);
}
}
catch(XPathException xpe)
{
}
}
示例12: Update
// Update is called once per frame
void Update()
{
if (GameObject.FindGameObjectsWithTag("MainObject").Length > 1)
{
GameObject[] list = GameObject.FindGameObjectsWithTag("MainObject");
for (int i = 0; i < list.Length; ++i)
{
if (!list[i].GetComponent<GameStateManager>().objectSaved)
GameObject.Destroy(list[i]);
else
gameStateManagerRef = list[i].GetComponent<GameStateManager>();
}
}
if (gameStateManagerRef.GetScreenManager().GetCurrentScreenArea() != ScreenAreas.LevelComplete)
{
if (levelCompleteText)
{
levelCompleteText.GetComponent<GUIText>().enabled = false;
}
if (swipeToContinueText)
{
swipeToContinueText.GetComponent<GUIText>().enabled = false;
}
}
}
示例13: Start
// Use this for initialization
void Start()
{
gameStateManagerRef = GameObject.FindGameObjectWithTag("MainObject").GetComponent<GameStateManager>();
GameObject levelCompleteGUI = GameObject.FindGameObjectWithTag("EndLevelObject");
GameObject blackFadeElement = GameObject.FindGameObjectWithTag("BlackFade");
levelCompleteText = GameObject.FindGameObjectWithTag("LevelCompleteText");
swipeToContinueText = GameObject.FindGameObjectWithTag("SwipeToContinueText");
if (levelCompleteGUI)
{
levelCompleteGUI.GetComponent<GUITexture>().enabled = false;
levelCompleteGUI.GetComponent<Camera>().enabled = false;
levelCompleteGUI.GetComponent<GUILayer>().enabled = false;
}
if (blackFadeElement)
{
blackFadeElement.GetComponent<GUITexture>().enabled = false;
blackFadeElement.GetComponent<Camera>().enabled = false;
blackFadeElement.GetComponent<GUILayer>().enabled = false;
}
if (levelCompleteText)
{
levelCompleteText.GetComponent<GUIText>().enabled = false;
}
if (swipeToContinueText)
{
swipeToContinueText.GetComponent<GUIText>().enabled = false;
}
}
示例14: Start
// Use this for initialization
void Start()
{
// Define state to name mapping for animations
state_to_name.Add(0, "Idle");
state_to_name.Add(1, "Walk");
state_to_name.Add(2, "Charge");
state_to_name.Add(3, "Grenade");
state_to_name.Add(4, "Jump");
state_to_name.Add(5, "Scared");
state_to_name.Add(6, "Touch");
state_to_name.Add(7, "Whisper");
GameState = FindObjectOfType<GameStateManager>();
if (GameState == null)
{
Debug.Log("GameStateManager missing! Abort!");
this.enabled = false;
return;
}
else
{
MainPlayer = gameObject.GetComponent<Player>();
PlayerPhysics = gameObject.GetComponent<Rigidbody2D>();
PlayerCollider = gameObject.GetComponent<BoxCollider2D>();
PlayerAnimator = gameObject.GetComponent<Animator>();
if (MainPlayer != null && PlayerPhysics != null)
{
PlayerNumber = (int)XboxInput;
//No setup anymore!
}
}
}
示例15: GameState
public GameState(Game game, GameStateManager manager)
: base(game)
{
_stateManager = manager;
_childComponents = new List<GameComponent>();
_tag = this;
}