void OnGUI() { GUILayoutOption[] width200 = new GUILayoutOption[] {GUILayout.Width(200)}; GUILayout.BeginArea(new Rect((Screen.width / 2) - 200, (Screen.height / 2) - 100, 400, 200)); GUILayout.BeginVertical(); GUILayout.Label("Time Left:" + this.timeLeft.ToString("0.000")); if (this.gs == gameState.waiting || this.gs == gameState.running) { if (GUILayout.Button("Click me as much as you can in " + this.startTime.ToString("0") + " seconds!")) { this.totalScore++; this.gs = gameState.running; } GUILayout.Label("Total Score: " + this.totalScore.ToString()); } if (this.gs == gameState.enterscore) { GUILayout.Label("Total Score: " + this.totalScore.ToString()); GUILayout.BeginHorizontal(); GUILayout.Label("Your Name: "); this.playerName = GUILayout.TextField(this.playerName, width200); if (GUILayout.Button("Save Score")) { // add the score... dl.AddScore(this.playerName, totalScore); this.gs = gameState.leaderboard; } GUILayout.EndHorizontal(); } if (this.gs == gameState.leaderboard) { GUILayout.Label("High Scores:"); DreamloLeaderBoard.Score[] scoreList = dl.ToScoreArray(); if (scoreList == null) { GUILayout.Label("(loading...)"); } else { foreach (DreamloLeaderBoard.Score currentScore in scoreList) { GUILayout.BeginHorizontal(); GUILayout.Label(currentScore.PlayerName, width200); GUILayout.Label(currentScore.PlayerScore.ToString(), width200); GUILayout.EndHorizontal(); } } } GUILayout.EndVertical(); GUILayout.EndArea(); }
// Update is called once per frame void Update() { if (CrossPlatformInputManager.GetAxis("Start") != 0) { start = start + 0.0001f; } if (start == 0.0001f) { gState = gameState.playing; } if (gState == gameState.playing) { if (CrossPlatformInputManager.GetButtonDown("Pause")) { isPaused = !isPaused; } if (isPaused) { Time.timeScale = 0; } else if (!isPaused) { Time.timeScale = 1; if (failed) { StartEndSequence(); } UpdateHealth(); UpdateTime(); } } }
private void startGame() { GameState = gameState.GameStarted; startMenuCamera.enabled = false; Camera.main.enabled = true; spawnWave.enabled = true; }
//Here we create the Map void initialize() { //we init the app this.GetComponent <createField>().initMe(); //We change the game status theCurrGameState = gameState.playGame; }
/*public enum whoTurns{ * waitingPlayer, * waitingOpponent, * player, * opponent * * }*/ //public static whoTurns theCurrTurn; // Use this for initialization void Start() { //We Init the game theCurrGameState = gameState.initialize; print("<B> We boot the Game: " + theCurrGameState); //theCurrTurn = whoTurns.player; }
public void SwitchMenu(gameState myState) { switch (myState) { case gameState.MainMenu: mainMenu.SetActive(true); loseMenu.SetActive(false); break; case gameState.Preparation: mainMenu.SetActive(false); break; case gameState.InGame: inGameMenu.SetActive(true); pauseMenu.SetActive(false); Time.timeScale = 1; break; case gameState.Pause: inGameMenu.SetActive(false); pauseMenu.SetActive(true); Time.timeScale = 0; break; case gameState.Lose: myState = gameState.Lose; loseMenu.SetActive(true); inGameMenu.SetActive(false); break; default: break; } }
IEnumerator enemyAction() { yield return(new WaitForSeconds(1.5f)); int choice = Random.Range(1, 3); if (choice == 1) { player.GetComponent <Player>().health -= Random.Range(5, 10); } if (choice == 2) { enemy.GetComponent <Enemy>().shield += Random.Range(1, 5); } if (choice == 3) { } yield return(new WaitForSeconds(1.5f)); player.GetComponent <Player>().energy = player.GetComponent <Player>().energyMax; GameState = gameState.PLAYERTURN; yield return(null); }
public void showScores() { currentState = gameState.Scores; highScoreMenu.SetActive(true); titleMenu.SetActive(false); gameOverMenu.SetActive(false); }
public void StartSuccessSequence() { succeeded = true; start = 0; gState = gameState.success; Invoke("LoadNextLevel", 1); }
void Start() { timeLeft = 90; oilTimeLeft = 0; state = gameState.levelStart; }
public void GameOver() { state = gameState.winner; resetData(); }
void Update() { shotAngleVector = Quaternion.AngleAxis(shotAngle, Vector3.up) * shotAngleVector; // calculate this properly next if (currentState == gameState.waiting) { if (disableInput == false) { if (Input.GetMouseButtonDown(0)) { StartShot(); currentState = gameState.aiming; } } } else if (currentState == gameState.aiming) { DoShot(); if (Input.GetMouseButtonUp(0)) { EndShot(); currentState = gameState.shooting; } } else if (currentState == gameState.shooting) { CheckBall(); } CheckHeight(); }
public void tickTock() { getInput(); if (Gtate == gameState.ongoing) { this.food.TickTock(); this.food.Show(this.CurrentBoard); this.snake.TickTock(); /* * if(snake.Lenght % 10 ==0) * this.refOfTimer.Interval = this.refOfTimer.Interval.Subtract(TimeSpan.FromMilliseconds(5)); */ if (this.snake.IsAlive) { this.snake.TickTock(); } else { Gtate = gameState.ended; this.gameEnded(); } //this.snake.Show(this.CurrentBoard); } }
void Awake() { instance = this; DontDestroyOnLoad(gameObject); currentGamestate = gameState.SplashScreen; //StartCoroutine(LoadMenu()); }
// Update is called once per frame void Update() { if (oldState != myState) { if (oldState != gameState.normal) { iconAc.SetTrigger("stopAnim"); } if (myState != gameState.normal) { iconAc.SetTrigger("playAnim"); } switch (myState) { case gameState.alerted: iconImage.sprite = alerted; break; case gameState.retreat: iconImage.sprite = retreat; break; case gameState.scared: iconImage.sprite = scared; break; } oldState = myState; } }
void Start() { // get the reference here... this.dl = dreamloLeaderBoard.GetSceneDreamloLeaderboard(); this.gs = gameState.enterscore; }
public void startBattle() { resourceManager = GetComponent <resourceManager>(); logManager = GetComponent <logManager>(); cameraManager = GetComponent <cameraManager>(); mapManager = GetComponent <mapManager>(); unitPanelManager = GetComponent <unitPanelManager>(); topPanelManager = GetComponent <topPanelManager>(); equipmentPanelManager = GetComponent <equipmentPanelManager>(); mapManager.initialize(); mapManager.generateMap(); mapManager.avalibityMapReset(false); cameraManager.initilize(); unitPanelManager.intialize(); topPanelManager.initialize(); equipmentPanelManager.initialize(); //temponary location allUnits = resourceManager.getActiveRooster(); allUnits.AddRange(resourceManager.getEnemyRooster()); foreach (Unit unit in allUnits) { unit.setPawn(resourceManager.getPawnPrefab()); unit.setPawnPosition(grid.CellToWorld(new Vector3Int(unit.getPosition()[0], unit.getPosition()[1], 0))); unit.rollInitiative(); mapManager.placeUnit(unit.getPosition()); } mapManager.avalibityMapReset(false); unitsToGo = allUnits; GameState = gameState.endTurn; }
public void bSelectToBAction() { if (onBSelectEnd != null) { onBSelectEnd(); } //State Change Actions nextTurnButton.onClick.RemoveAllListeners(); if (GameInfo.singleton.unresolvedCards.Count <= 1) { nextTurnButton.onClick.AddListener(bActionToBConfirm); } else { nextTurnButton.onClick.AddListener(bActionToBAction); } currentState = gameState.BAction; if (onBActionBegin != null) { onBActionBegin(); } if (GameInfo.singleton.unresolvedCards.Count >= 1) { activateCard(); } }
private void manageTimer(gameState state) { switch (state) { case gameState.InitialGame: stopwatch.Start(); timerUpdateLabel.Start(); break; case gameState.NewGame: txtTime.Text = "00:00:00"; // In order to stop the delay. timerUpdateLabel.Stop(); // In order to stop the delay. timerUpdateLabel.Start(); // In order to stop the delay. stopwatch.Restart(); break; case gameState.Restart: break; case gameState.End: timerUpdateLabel.Stop(); break; default: break; } }
public void actionToAction() { if (onActionEnd != null) { onActionEnd(); } nextTurnButton.onClick.RemoveAllListeners(); if (GameInfo.singleton.unresolvedCards.Count <= 1) { nextTurnButton.onClick.AddListener(actionToConfirm); } else { nextTurnButton.onClick.AddListener(actionToAction); } activateCard(); currentState = gameState.Action; if (onActionBegin != null) { onActionBegin(); } if (GameInfo.singleton.unresolvedCards.Count >= 1) { activateCard(); } }
public void GameStart() { if (Input.GetKeyDown(KeyCode.Escape)) { Application.LoadLevel(6); } gameStartPanel.gameObject.SetActive(true); if (numberOfPencils != 1) { Instantiate(pencil, new Vector3(6f, Random.Range(-0.4f, 4.0f), 0), transform.rotation); numberOfPencils += 1; addedDistance = 6; } if (Application.platform != RuntimePlatform.Android) { if (Input.GetButtonDown("Jump") || Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.JoystickButton0)) { currentState = gameState.playing; } } else { if (Input.touchCount > 0) { if (Input.GetTouch(0).phase == TouchPhase.Began) { currentState = gameState.playing; } } } }
void OnTriggerEnter2D(Collider2D col) { switch (col.gameObject.tag) { case ("TriggerZone"): ForwardMove(new Vector2(animator.GetFloat("forwardMove"), 4f)); state = gameState.newCicle; rigidbody.simulated = true; animator.SetFloat("forwardMove", runSpeed); rigidbody.gravityScale = 1; rigidbody.angularDrag = 0.05f; break; case ("BeginningZone"): state = gameState.beginning; rigidbody.simulated = true; animator.SetFloat("forwardMove", 10f); rigidbody.gravityScale = 0.25f; rigidbody.angularDrag = 0.05f; break; case ("EndGame"): Debug.Log("cab"); state = gameState.theEnd; totalExerciseTime = Time.realtimeSinceStartup - totalExerciseTime; break; default: animator.SetFloat("forwardMove", 0); break; } }
public void selectToAction() { if (onSelectEnd != null) { onSelectEnd(); } //State Change Actions nextTurnButton.onClick.RemoveAllListeners(); if (GameInfo.singleton.unresolvedCards.Count <= 1) { nextTurnButton.onClick.AddListener(actionToConfirm); } else { nextTurnButton.onClick.AddListener(actionToAction); } GameInfo.singleton.HideField(); activateCard(); HandDropZone.singleton.SetCardsBlockRaycast(false); currentState = gameState.Action; if (onActionBegin != null) { onActionBegin(); } if (GameInfo.singleton.unresolvedCards.Count >= 1) { activateCard(); } }
private void Start() { state = gameState.Start; stageCreater = Instantiate(stageCreater); stageCreater.transform.parent = transform; player = Instantiate(player); player.transform.parent = transform; footPrinter = Instantiate(footPrinter); footPrinter.transform.parent = transform; effectSpawner = Instantiate(effectSpawner); effectSpawner.transform.parent = transform; effectSpawner2 = Instantiate(effectSpawner2); effectSpawner2.transform.parent = transform; stageCreater.footPrinter = footPrinter; stageCreater.effectSpawner = effectSpawner; stageCreater.effectSpawner2 = effectSpawner2; player.haveMapDateObject = stageCreater; }
public void attack() { state=gameState.attack;//this is just to advance the gamestate until we have the build functionality down //when we are ready to change to attack state we set the cannon up for the new round Trans.position =new Vector3(-42F,4.5F,0); RB.position=new Vector3(-42F,4.5F,0); RB.velocity = new Vector3(0,0,0);//zero; resetCost (maxCost); int randomNumber = Random.Range(0, 2); switch (randomNumber){ case 0: //low shotAngle = 20 + Random.Range(0,5); shotPower = (1400 + Random.Range(0,200)) *RB.mass; break; case 1: shotAngle = 35 + Random.Range (0,10); shotPower = (1200 + Random.Range(0,300)) *RB.mass; break; case 2: shotAngle = 55 + Random.Range(0,10); shotPower = (1000 + Random.Range(0,300)) *RB.mass; break; } shotAngle = 90F - shotAngle; RB.position=new Vector3(-42F+(Mathf.Sin(shotAngle*Mathf.Deg2Rad)*2.5F),4.5F+(Mathf.Cos(shotAngle*Mathf.Deg2Rad)*2.5F),0); RB.AddForce(new Vector3(Mathf.Sin(shotAngle * Mathf.Deg2Rad)*shotPower,Mathf.Cos(shotAngle * Mathf.Deg2Rad)*shotPower,0)); shotTime=Time.time; GameObject.Find("Cannon").transform.Rotate(new Vector3(0,0,90-shotAngle)); }
IEnumerator Die() { lockInput = true; yield return new WaitForSeconds (0.7f); // Application.LoadLevel(Application.loadedLevel); this.gs = gameState.enterscore; }
public void RestartGame() { // slowly fade the camera to black screenFadeController.FadeAlphaToBlack(); currentState = gameState.resetting; }
public void exitLevel() { currentState = gameState.END; levelUpdate(); questsUpdate(); preLevel.openModal(level); }
// Use this for initialization void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); gameObject.SetActive(true); state = gameState.INTRO; switch (state) { case gameState.INTRO: score = 0.0f; gameSpeed = startingGameSpeed; break; } }
//stateを変える関数 private void StateChange() { switch (state) { //StartからGameへ case (gameState.Start): state = gameState.Game; GameStart(); break; //GameからClearへ case (gameState.Game): state = gameState.Clear; GameEnd(); break; case (gameState.Clear): state = gameState.Result; break; case (gameState.Result): state = gameState.Start; stageName++; break; } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } if (endState && triggerEnd) { gameStatus = gameState.Win; } switch (gameStatus) { case gameState.Start: StartGame(gameTime); break; case gameState.Pause: PauseGame(gameTime); break; case gameState.Win: WinGame(gameTime); break; case gameState.Lose: LoseGame(gameTime); break; } // TODO: Add your update logic here base.Update(gameTime); }
/// <summary> /// Joins an existing network session. /// </summary> void JoinSession() { DrawMessage("Joining game..."); try { // Search for sessions. using (AvailableNetworkSessionCollection availableSessions = NetworkSession.Find(NetworkSessionType.SystemLink, maxLocalGamers, null)) { if (availableSessions.Count == 0) { errorMessage = "Server not found"; return; } // Join the first session we found. networkSession = NetworkSession.Join(availableSessions[0]); state = gameState.game; HookSessionEvents(); errorMessage = null; } } catch (Exception e) { errorMessage = e.Message; } }
/// <summary> /// Draws the startup screen used to create and join network sessions. /// </summary> void DrawLobby() { string message = string.Empty; string msg1 = string.Empty; message += "Press 'ENTER' to start\n" + "Press 'ESC' to quit"; msg1 += " WELCOME TO 'OMEGA RACE' MULTIPLAYER GAME"; spriteBatch.Begin(); spriteBatch.DrawString(font, msg1, new Vector2(130, 130), Color.Aqua); spriteBatch.DrawString(font, message, new Vector2(200, 200), Color.Aqua); spriteBatch.DrawString(font, message, new Vector2(200, 200), Color.Red); spriteBatch.End(); if (IsPressed(Keys.Enter, Buttons.B)) { DrawMenuScreen(); state = gameState.ready; } else if (IsPressed(Keys.Escape, Buttons.Back)) { Exit(); state = gameState.ready; } }
void Update() { if (Input.GetMouseButtonDown(0)) { this.gs = gameState.enterscore; } }
// Update is called once per frame void Update () { ///////////////// STATES /////////////// switch (currentState) { case gameState.starting: //**STARTING**// if(player_ref.waiting==false) //if player has given first input (valid swipe) currentState = gameState.playing; //go to playing break; case gameState.playing: //**PLAYING**// //update point counter points_text.GetComponent<UILabel>().text = points.ToString (); GameObject.Find("instructions").GetComponent<UILabel>().enabled = false; break; case gameState.scoring: //**SCORING**// if(Bar.GetComponent<UISprite> ().alpha<1f) { Bar.GetComponent<UISprite> ().alpha += 0.1f; //make the bar visible } points_text.GetComponent<UILabel>().text = points.ToString ();//update point counter //reduce points and add to total points over time pointCountTime+=Time.deltaTime; if(pointCountTime>=0.02f && points>0) { points -= 1; //remove from points (counter) totalPoints += 1; //add to total points (bar) audio.PlayOneShot(collectSound); //bar_glow.glow("add"); points_text.GetComponent<TweenScale> ().ResetToBeginning (); points_text.GetComponent<TweenScale>().PlayForward(); pointCountTime = 0f; //reset counter } //Update progress bar with total points float pointsF = totalPoints; float goalF = goal; progressBar.value = (float)(pointsF / goalF); level_text.text = level.ToString(); //IF WE HIT GOAL THEN LEVEL UP if (totalPoints >= goal) { levelUp(); } //end round when done counting if(points==0) { newRoundDelay += Time.deltaTime; if(newRoundDelay>2f) newRound(); } break; case gameState.paused: //**PAUSED**// //do nothing break; } }
public void FlipGameState() { if(!GLOBAL.gameOver && gs == gameState.leaderboard){ gs = gameState.running; } else { gs = gameState.leaderboard; } }
public void LevelSelect() { mainMenuPanel.gameObject.SetActive(false); levelSelectPanel.gameObject.SetActive(true); if (Input.GetKeyDown(KeyCode.Escape)) { levelSelectPanel.gameObject.SetActive(false); currentState = gameState.mainMenu; } }
public void GameOver() { if(currentGameState != gameState.GameOver) { currentGameState = gameState.GameOver; uiScript.TurnOffGameUI(); BringInGameOverPanel(); } }
void Update () { if (this.gs == gameState.running) { timeLeft = Mathf.Clamp(timeLeft - Time.deltaTime, 0, this.startTime); if (timeLeft == 0) { this.gs = gameState.enterscore; } } }
void Start () { // get the reference here... this.dl = dreamloLeaderBoard.GetSceneDreamloLeaderboard(); // get the other reference here this.pc = dreamloPromoCode.GetSceneDreamloPromoCode(); this.timeLeft = startTime; this.gs = gameState.waiting; }
public Playmode(gameState s, KTYD.Model.Map g, Boolean p, KeyboardState i, bool[] ps, float st, float[] t, Controller.Players gPlayers, Dictionary<PlayerIndex, int> test, View.View gView) : base(s) { c = test; gamePlayers = gPlayers; gameMap = g; pauseGame = p; input = i; pressShoot = ps; storeTime = st; time = t; gameView = gView; }
// Use this for initialization void Start () { player_ref = GameObject.Find ("Player").GetComponent<ec_player>(); currentState = gameState.starting; //set initial gamestate Bar = GameObject.Find("bar"); points_text = GameObject.Find("points"); tile_list = tile_list_editor; //assign our static list to the editor list so that our static function can use it lastTile = lastTile_editor; //assign our static lastTile to the editor one so that our static function can use it coinDecrease = Mathf.RoundToInt(goal/10); tileCount = 0; //reset tile count on new round //Call initial tile spawn spawnTile(); }
void Awake() { if(gamestate == null) { gamestate = this; DontDestroyOnLoad(gameObject); PlayGamesPlatform.DebugLogEnabled = true; PlayGamesPlatform.Activate(); } else if(gamestate != this) { Destroy(gameObject); } }
void Start () { // get the reference here... this.dl = dreamloLeaderBoard.GetSceneDreamloLeaderboard(); this.timeLeft = startTime; if (Menu) { this.gs = gameState.leaderboard; } else { this.gs = gameState.enterscore; } }
// Use this for initialization void Start() { gameStateRef = GetComponentInParent<UIRefrences>().gameStateRefUI; if (gameStateRef == null) { Debug.Log("GameState is null"); activeElement = false; } // inputFieldRef = GetComponentInParent<InputField>(); if (inputFieldRef == null) { Debug.Log("InputField is null"); activeElement = false; } }
// Update is called once per frame void Update() { if(Input.GetKeyDown(KeyCode.Escape)){ if(currentState == gameState.Running){ currentState = gameState.Paused; }else{ currentState = gameState.Running; } } if(currentState == gameState.Paused){ stateText.text = "PAUSED"; }else{ stateText.text = ""; } }
void Start() { smallFont = new GUIStyle (); largeFont = new GUIStyle (); smallFont.fontSize = 18; largeFont.fontSize = 20; lockInput = false; this.gs = gameState.running; // get the reference here... this.dl = dreamloLeaderBoard.GetSceneDreamloLeaderboard(); // get the other reference here this.pc = dreamloPromoCode.GetSceneDreamloPromoCode(); }
IEnumerator GameEnd() { mainUI.SetActive(false); gameUI.SetActive(false); gameOverUI.SetActive(true); pauseMenuUI.SetActive(false); state = gameState.gameOver; finalScoreText.GetComponent<GUIText>().text = "Final Score: " + score; Destroy(player); StopAllCoroutines(); score = startingScore; playerLives = startingLives; yield return null; }
public GameManager() { //initalise the game gameState = gameState.programInit; menu = menus.main; hasJoy = false; messageBuffer = new string[50]; for (int i = 0; i < 50; i++) { messageBuffer[i] = ""; } cammoving = false; camAddX = 0; camAddY = 0; player = new Player(new Vector3(0, 0, 0), Quaternion.IDENTITY); }
// Change the current game state of this object public void ChangeState(gameState state) { UpdateHandler init; bool success = m_stateInits.TryGetValue(state, out init); if (success) { init(); } #if UNITY_EDITOR else { Debug.LogError("Could not find delegate method for init of state: " + state); } #endif success = m_stateUpdates.TryGetValue(state, out m_currentUpdate); #if UNITY_EDITOR if(!success) { Debug.LogError("Could not find delegate method for state: " + state); } #endif }
private void newGame() { manager = null; manager = RTSManager.Instance(Window.ClientBounds.Width, Window.ClientBounds.Height, Content); RTSManager.NewGame(); curState = gameState.Playing; }
private void gameStart(GameTime gameTime, ref MouseState mouse, ref KeyboardState keys) { start.mouseOver(mouse); exit.mouseOver(mouse); options.mouseOver(mouse); save.mouseOver(mouse); load.mouseOver(mouse); if (start.pressed(mouse, oldMouse)) { newGame(); } if (exit.pressed(mouse, oldMouse)) { this.Exit(); } if (options.pressed(mouse, oldMouse)) { curState = gameState.Options; } if (save.pressed(mouse, oldMouse)) { } if (load.pressed(mouse, oldMouse)) { } }
private void gamePlaying(GameTime gameTime, ref MouseState mouse, ref KeyboardState keys) { if (keys.IsKeyDown(Keys.Escape) && oldKeys.IsKeyUp(Keys.Escape)) { curState = gameState.Paused; } if (mouse.X < SLOWCAM) { if (mouse.X < FASTCAM) { manager.setCameraSpeed(FASTCAM_SPEED); manager.moveWorldLeft(); } else { manager.setCameraSpeed(SLOWCAM_SPEED); manager.moveWorldLeft(); } } else if (mouse.X > (GameOptions.getWidth() - SLOWCAM)) { if (mouse.X > (GameOptions.getWidth() - FASTCAM)) { manager.setCameraSpeed(FASTCAM_SPEED); manager.moveWorldRight(); } else { manager.setCameraSpeed(SLOWCAM_SPEED); manager.moveWorldRight(); } } if (mouse.Y < SLOWCAM) { if (mouse.Y < FASTCAM) { manager.setCameraSpeed(FASTCAM_SPEED); manager.moveWorldUp(); } else { manager.setCameraSpeed(SLOWCAM_SPEED); manager.moveWorldUp(); } } else if (mouse.Y > (GameOptions.getHeight() - SLOWCAM)) { if (mouse.Y > (GameOptions.getHeight() - FASTCAM)) { manager.setCameraSpeed(FASTCAM_SPEED); manager.moveWorldDown(); } else { manager.setCameraSpeed(SLOWCAM_SPEED); manager.moveWorldDown(); } } manager.update(new Vector2(mouse.X, mouse.Y), mouse.LeftButton, mouse.RightButton, keys, gameTime); if (keys.IsKeyDown(Keys.Space)) { RTSManager.REMOVEME(); } if (GameOptions.isGameOver()) { curState = gameState.GameOver; } }
private void gameOver(GameTime gameTime, ref MouseState mouse, ref KeyboardState keys) { PlayAgain.mouseOver(mouse); mainMenu.mouseOver(mouse); showScore.setText("Score: " + RTSManager.getScore().ToString()); if (PlayAgain.pressed(mouse, oldMouse)) { newGame(); } if (mainMenu.pressed(mouse, oldMouse)) { curState = gameState.Start; } }
private void diffOptions(GameTime gameTime, ref MouseState mouse, ref KeyboardState keys) { easy.mouseOver(mouse); medium.mouseOver(mouse); hard.mouseOver(mouse); if (easy.pressed(mouse, oldMouse)) { GameOptions.setDifficulty(GameOptions.GameDifficulties.Easy); if (GameOptions.isGamePlaying()) { curState = gameState.Paused; } else { curState = gameState.Start; } } if (medium.pressed(mouse, oldMouse)) { GameOptions.setDifficulty(GameOptions.GameDifficulties.Medium); if (GameOptions.isGamePlaying()) { curState = gameState.Paused; } else { curState = gameState.Start; } } if (hard.pressed(mouse, oldMouse)) { GameOptions.setDifficulty(GameOptions.GameDifficulties.Hard); if (GameOptions.isGamePlaying()) { curState = gameState.Paused; } else { curState = gameState.Start; } } }
protected void GameEnd() { _creature.set_state (creature_state.idle); _game_state = gameState.game_end; global_instance.Instance._ngui_edit_manager.game_win(); }
public void next_update() { if(_record._open_record == true) { if(_creature._Creature_history.Count == 0&&_record._creature_lock != true&& _need_play_animation == false) { int count = _History._mol_history.Count; if (count > 0) { _record._frame_begin = _current_frame_count; MolMoveHistory history = _History._mol_history[count - 1]; _History._mol_history.RemoveAt(count - 1); if (history._Creature_acts.Count != 0) { _record._creature_lock = true; foreach(CreatureHistory entry in history._Creature_acts) { _creature._Creature_history.Add(entry); } } int mole_count = history.move_moles.Count; List<crash_mole> temp_list = new List<crash_mole> (); foreach(crash_mole entry in history.move_moles) { temp_list.Add(entry); } switch(history._dir) { case dir_move.back: { _last_move_dir = dir_move.front; } break; case dir_move.front: { _last_move_dir = dir_move.back; } break; case dir_move.left: { _last_move_dir = dir_move.right; } break; case dir_move.right: { _last_move_dir = dir_move.left; } break; case dir_move.down: { _last_move_dir = dir_move.up; } break; case dir_move.up: { _last_move_dir = dir_move.down; } break; } if(temp_list.Count != 0) { move_list(temp_list, _last_move_dir); } } else { _record.ready_for_record_closed(); _record.try_to_next_state (); } } } else { bool temp = need_fall_update(); if (temp == false && _need_play_animation == false && _crash_moles_list.Count != 0) { _game_state = gameState.game_playing; } if (temp) { _record.try_to_next_state (); } } }
private void Options(GameTime gameTime, ref MouseState mouse, ref KeyboardState keys) { if (!GameOptions.isGamePlaying()) { difficulty.mouseOver(mouse); } resolution.mouseOver(mouse); fullScreen.mouseOver(mouse); if (difficulty.pressed(mouse, oldMouse) && !GameOptions.isGamePlaying()) { curState = gameState.OptionsDifficulty; } if (resolution.pressed(mouse, oldMouse)) { curState = gameState.OptionsResolution; } if (fullScreen.pressed(mouse, oldMouse)) { GameOptions.toggleFullScreen(); if (GameOptions.isGamePlaying()) { curState = gameState.Paused; } else { curState = gameState.Start; } } }
private void resOptions(GameTime gameTime, ref MouseState mouse, ref KeyboardState keys) { small.mouseOver(mouse); mediumRes.mouseOver(mouse); large.mouseOver(mouse); if (small.pressed(mouse, oldMouse)) { GameOptions.setScreen(800, 600); if (GameOptions.isGamePlaying()) { curState = gameState.Paused; } else { curState = gameState.Start; } } if (mediumRes.pressed(mouse, oldMouse)) { GameOptions.setScreen(1280, 1024); if (GameOptions.isGamePlaying()) { curState = gameState.Paused; } else { curState = gameState.Start; } } if (large.pressed(mouse, oldMouse)) { GameOptions.setScreen(1920, 1080); if (GameOptions.isGamePlaying()) { curState = gameState.Paused; } else { curState = gameState.Start; } } }
public void clear() { clear_enclosure(); if (_crash_objs != null && _crash_moles != null) { for (int x = 0; x < (int)_max_x; x++) { for (int y = 0; y < (int)_max_y; y++) { for (int z = 0; z < (int)_max_z; z++) { _crash_objs[x, z, y]._crash_obj = null; _crash_moles[x, z, y]._crash_mole = null; } } } } _grid_distance = (float)1; _need_play_animation = false; _move_animation_distance = (float)0.1; int length = _Game_objs.Count; for(int i = 0; i < length; i ++) { GameObject obj = (GameObject)_Game_objs[i]; GameObject.Destroy(obj); } _crash_moles_list.Clear(); _move_mole_list.Clear(); _Game_objs.Clear(); _obj_creature = null; _freezen_creature = false; _lock_mole.Clear (); if(_creature != null) { _creature.gameObject.SetActive(false); } _catch_click_list.Clear(); _game_state = gameState.game_prepare; _History.reset(); _current_frame_count = 0; _move_count = 0; }