本文整理汇总了C#中GameStates类的典型用法代码示例。如果您正苦于以下问题:C# GameStates类的具体用法?C# GameStates怎么用?C# GameStates使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GameStates类属于命名空间,在下文中一共展示了GameStates类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Win
public void Win()
{
if(gameState == GameStates.Playing) {
gameState = GameStates.Won;
winScreen.SetActive(true);
}
}
示例2: destroyGameState
private void destroyGameState(GameStates pState)
{
switch (pState)
{
case GameStates.menu:
{
if (_menu != null) { _menu.Destroy(); }
break;
}
case GameStates.level:
{
//if (_level != null) { _level.Destroy(); }
break;
}
case GameStates.bossarena:
{
if (_bossArena != null) { _bossArena.Destroy(); }
break;
}
case GameStates.nameinput:
{
if (_nameinput != null) { _nameinput.Destroy(); }
break;
}
case GameStates.endscreen:
{
if (_endscreen != null) { _endscreen.Destroy(); }
break;
}
}
}
示例3: EnterMenu
public void EnterMenu(GameStates stateWhenEntering, GameStates menuTypeToEnter)
{
previousGameState = stateWhenEntering;
currentSelectionIndex = 0;
prevSelectionIndex = 0;
menuType = menuTypeToEnter;
if (menuType == GameStates.MainMenu)
{
Game.SoundManager.PlaySong("LOD", true);
foreach (MenuEntry entry in MainMenuEntries.Keys)
{
entry.SetUnselected();
}
MainMenuEntries.ElementAt(currentSelectionIndex).Key.SetSelected();
}
else if (menuType == GameStates.PAUSE)
{
foreach (MenuEntry entry in PauseMenuEntries.Keys)
{
entry.SetUnselected();
}
PauseMenuEntries.ElementAt(currentSelectionIndex).Key.SetSelected();
}
}
示例4: ChangeToState
public static void ChangeToState(GameStates state)
{
switch (state)
{
case GameStates.MainMenuState:
CurrentState = new MainMenuState(currentScreenSize);
break;
case GameStates.LevelOneState:
CurrentState = new LevelOneState(content, currentScreenSize);
break;
case GameStates.LevelTwoState:
CurrentState = new LevelTwoState(content, currentScreenSize);
break;
case GameStates.LevelThreeState:
CurrentState = new LevelThreeState(content, currentScreenSize);
break;
case GameStates.FinalLevel:
CurrentState = new FinalLevel(content, currentScreenSize);
break;
case GameStates.Quit:
CurrentState = new QuitState(currentScreenSize);
break;
case GameStates.PickName:
CurrentState = new PickNameState(currentScreenSize);
break;
case GameStates.HighScore:
CurrentState = new HighScoreState(currentScreenSize);
break;
}
if (UnSeriousEngine.isInitialized)
{
CurrentState.LoadContent(Content);
}
}
示例5: FirstEvent
// Event
public void FirstEvent()
{
eventManager.firstEvent -= FirstEvent;
state = GameStates.Stop;
Vector3 cameraPos = Camera.main.gameObject.transform.position;
Instantiate (bossList[0], new Vector3(cameraPos.x, cameraPos.y + 12f, 0f), Quaternion.identity);
}
示例6: inputHandler
private void inputHandler()
{
if (Input.GetKeyDown("p")) {
state = state == GameStates.Run ? GameStates.Pause : GameStates.Run;
Time.timeScale = Time.timeScale == 0f ? 1f : 0f;
}
}
示例7: GameClass
// The GameClass constructor. Here we create, but not show, the GameSettings form.
// The
public GameClass(MainClass mainClass, Control owner)
{
gameState = GameStates.Loading;
this.owner = owner;
this.mainClass = mainClass;
splash = new SplashScreen(this);
splash.ShowDialog();
gameSettings = new SpaceWar.GameSettings(this);
gameSettings.Location = new Point(owner.Bounds.Right,owner.Bounds.Top);
gravity = gameSettings.Gravity;
gameSpeed = gameSettings.GameSpeed;
bounceBack = gameSettings.Bounce;
inverseGravity = gameSettings.InverseGravity;
blackHole = gameSettings.BlackHole;
localDevice = new Microsoft.DirectX.DirectDraw.Device();
localDevice.SetCooperativeLevel(owner, Microsoft.DirectX.DirectDraw.CooperativeLevelFlags.Normal);
DXUtil.Timer(DirectXTimer.Start);
SpaceWar.RotatableShape.CreateShapes();
input = new InputClass(this.owner);
soundHandler = new SoundHandler(this.owner);
try {
netPeer = new PlayClass(this);
}
catch(DirectXException e) {
MessageBox.Show(owner,e.ToString());
}
}
示例8: Update
public void Update(GameTime gameTime, ref GameStates gameState)
{
if (_mControls.IsBackPressed(false))
gameState = GameStates.Exit;
if (_mControls.IsStartPressed(false) || _mControls.IsAPressed(false))
gameState = GameStates.MainMenu;
}
示例9: ReflexGameWindow
public ReflexGameWindow(string userName, int initialGameTime)
{
InitializeComponent();
SetMouseForm(gameWindow, CHART_WIDTH, CHART_HEIGHT, timeLabel);
setTimeOutMethod(timedOut);
setQuestionTime((double)initialGameTime);
CoordsList = new List<TimePoint>();
greenBrush = new SolidBrush(Color.Green);
blueBrush = new SolidBrush(Color.Blue);
redBrush = new SolidBrush(Color.Red);
this.maxGameTime = INITIAL_GAME_TIME = initialGameTime;
graphics = gameWindow.CreateGraphics();
gameState = GameStates.OutOfGame;
this.userName = userName;
rnd = new Random();
scoreLabel.Text = "";
timeLabel.Text = "";
stopRButton.Enabled = false;
stopLButton.Enabled = false;
}
示例10: setGameState
public void setGameState(GameStates pState)
{
if (pState == _state) return;
destroyGameState(_state);
_state = pState;
newGameState(pState);
}
示例11: ChangeState
public static void ChangeState(GameStates newState)
{
if (instance.state == newState)
return;
// Before change
switch (instance.state) {
case GameStates.Login:
break;
case GameStates.Playing:
instance.highscoreCanvas.gameObject.SetActive(false);
break;
case GameStates.Paused:
instance.pauseCanvas.gameObject.SetActive(false);
break;
}
instance.state = newState;
// After change
switch (instance.state) {
case GameStates.Login:
break;
case GameStates.Playing:
instance.highscoreCanvas.gameObject.SetActive(true);
break;
case GameStates.Paused:
instance.pauseCanvas.gameObject.SetActive(true);
break;
}
}
示例12: StartGame
public void StartGame()
{
currentGameState = GameStates.Play;
gamesFirstTouch = false;
//turns off all button menus
menuManager.SwitchMenu (MenuManager.MenuTypes.None);
}
示例13: Restart
public void Restart()
{
theGameState = GameStates.GS_USER_INPUT;
//reset the target's height
if (theTarget != null && theHill != null)
{
Vector3 targetNewPosistion = new Vector3(theHill.transform.position.x, theHill.transform.position.y, theHill.transform.position.z);
float hillXRotRadians = -Mathf.Deg2Rad * theHill.transform.rotation.eulerAngles.x;
float distUpHill = UnityEngine.Random.Range(-1.0f, 1.0f) * HILL_UNSCALED_HALF_WIDTH * theHill.transform.localScale.z;
//use polar coordinates & the hill's angle to randomly select a distance up the hill for the target
targetNewPosistion.x += UnityEngine.Random.Range(-HILL_HALF_WIDTH, HILL_HALF_WIDTH) / 2.0f;
targetNewPosistion.y += distUpHill * Mathf.Sin(hillXRotRadians);
targetNewPosistion.z += distUpHill * Mathf.Cos(hillXRotRadians);
/*print("targetNewPosition = " + targetNewPosistion + ", distUpHill = " + distUpHill + " hillXRotRadians = " + hillXRotRadians +
"euler.x = " + theHill.transform.rotation.eulerAngles.x);*/
theTarget.transform.Translate(targetNewPosistion - theTarget.transform.position);
}
//reset the ball
if (theBall != null)
{
theBall.Restart();
}
//reset the ballista
if (theBallista != null)
{
theBallista.Restart();
}
}
示例14: SwitchState
public void SwitchState(GameStates newState)
{
if (_currentState == newState)
return;
//run code
}
示例15: SetGameState
public void SetGameState(GameStates newState)
{
Debug.Log("Setting GameState :" + newState.ToString());
if (newState == GameStates.GameOverLoss) {
RestartGame();
}
}