private void exitGame() { if (InvalidMove != null) { EndOfGame.Invoke(getOppositionPlayer(), EventArgs.Empty); } }
private void FireGameOverIfNeeded() { if (NumberOfSticks == 0) { gameStage = GameStage.GameOver; EndOfGame.Invoke(WhoseTurn); } }
public void Win() { WinText.SetActive(true); IsWaitng = true; if (state == EndOfGame.Invalid) { state = EndOfGame.WinState; } }
public void Lose() { LoseText.SetActive(true); IsWaitng = true; if (state == EndOfGame.Invalid) { state = EndOfGame.LoseState; } }
EndOfGame() { //save time instead of searching for the game controller //check if the instance is not null, we are creating more than one instance, warn us if (instance != null) { Debug.LogError("There's an instance already created, click on the next error to check it", gameObject); Debug.LogError("Original EndOfGame instance is", instance.gameObject); return; } instance = this; }
public void Run(TextReader reader, TextWriter writer) { using (new TextConsole(this.bus, reader, writer)) using (new SentenceParser(this.bus, this.words)) using (EndOfGame endOfGame = new EndOfGame(this.bus)) using (InputLoop loop = new InputLoop(this.bus, ">")) using (new Inventory(this.bus)) using (this.InitializeMap()) { loop.Run(endOfGame.Token); } }
public void SendAfterDisposeDoesNothing() { MessageBus bus = new MessageBus(); string lastOutput = null; bus.Subscribe <OutputMessage>(m => lastOutput = "[" + m.Text + "]"); EndOfGame end = new EndOfGame(bus); end.Dispose(); bus.Send(new EndOfGameMessage("It's not over.")); lastOutput.Should().BeNull(); }
//default constructor private Player() { Name = "Ash"; Level = 1; EXP = 0; ATK = DEF = 5; // ATK = 5; DEF = 5; MaxHP = CurrentHP = 15; MaxMP = CurrentMP = 10; // MP = 10; TP = 10; Alive = true; abilityList = new List <PlayerAbility>(); InCombat = false; weapon = null; playerInventory = Inventory.haveOne(); endGame = EndOfGame.oneEnd(); }
public void EndOfGameNoMessageSendsCancellationNoOutput() { MessageBus bus = new MessageBus(); string lastOutput = null; bus.Subscribe <OutputMessage>(m => lastOutput = "[" + m.Text + "]"); using (EndOfGame end = new EndOfGame(bus)) { end.Token.IsCancellationRequested.Should().BeFalse(); bus.Send(new EndOfGameMessage()); end.Token.IsCancellationRequested.Should().BeTrue(); lastOutput.Should().BeNull(); } }
public void Fight(Player player) { Console.WriteLine( $"You see a monster in the room. It's {monsterName}!\n" + $"{monsterName} has {monsterDamage} in damage and {monsterHealth} healthpoints.\n" + $"You have {player.playerAttackDamage} in damage\n" + $"Press any key when you are ready to fight {monsterName}"); Console.ReadKey(true); Console.Clear(); bool turn = true; // true = player turn, false = monster turn do { if (turn == true) { Console.WriteLine($"You hit the {monsterName} for {player.playerAttackDamage} "); monsterHealth = monsterHealth - player.playerAttackDamage; Console.WriteLine($"{monsterName} have {monsterHealth} left"); Thread.Sleep(1000); turn = false; } else if (turn == false) { Console.WriteLine($"{monsterName} hit you for {monsterDamage}"); player.playerHealthPoints = player.playerHealthPoints - monsterDamage; Console.WriteLine("You have " + player.playerHealthPoints + " left"); Thread.Sleep(1000); turn = true; } }while (player.playerHealthPoints > 0 && monsterHealth > 0); Thread.Sleep(1000); Console.Clear(); if (monsterHealth > 0) { Console.WriteLine($"You lost the fight against {monsterName}"); EndOfGame endOfGame = new EndOfGame(); endOfGame.EndingGame(player); } else { Console.WriteLine($"After a hard fight against {monsterName} you are victorious!"); } }
private IEnumerator GameLoop() { yield return(StartCoroutine(RoundStarting())); yield return(StartCoroutine(RoundPlaying())); yield return(StartCoroutine(RoundEnding())); if (m_GameWinner != null) { RstButton.SetActive(false); EscButton.SetActive(false); EndOfGame.SetActive(true); } else { StartCoroutine(GameLoop()); } }
public bool GameOver() { bool gameOver = false; if (CurrentPlayer.IsLoose() || WaitingPlayer.Tie(CurrentPlayer)) { gameOver = !gameOver; // true CalcFinalScore(); EndOfGameEventArgs e = new EndOfGameEventArgs(); EndOfGame.Invoke(this, e); if (!e.m_GameOver) { PlayerHasScored.Invoke(this, new EventArgs()); Checkers.Board.ClearLogicBoard(); ResetGame(); } } return(gameOver); }
private void HearthEvent(HearthstoneEvent hearthEvent) { if (hearthEvent is NewGame) { var newGameEvent = hearthEvent as NewGame; hearthstoneGame = newGameEvent.game; SetState(null, typeof(HSStateAcceptingBets)); } else if (hearthEvent is EndOfGame) { var endGameEvent = hearthEvent as EndOfGame; lastGameEnding = endGameEvent; SetState(null, typeof(HSStateEndOfGame)); } else if (hearthEvent is DrawCard) { var drawEvent = hearthEvent as DrawCard; if (currentState is HSStatePlaying) { var playingState = currentState as HSStatePlaying; playingState.NextTurn(drawEvent); } } }
void Awake() { PhotonNetwork.isMessageQueueRunning = true; mainCamera = Camera.main.transform; _as = GetComponent <AudioSource>(); setCanvas(0); gameResult = GameObject.Find("GameResult"); gr = gameResult.GetComponent <GameResult>(); eg = GameObject.Find("EndOfGame").GetComponent <EndOfGame>(); eg.setActive(false); gi = GameObject.Find("GameItems(Clone)").GetComponent <GameItems>(); gameStarted = false; zoomed = false; gameover = false; swapCamPos = false; StartCoroutine(CheckPlayerNumber()); }
void Awake() { _gameSystem = GameObject.Find("_System").GetComponent<GameSystem>(); _end = GameObject.Find("EndOfGame").GetComponent<EndOfGame>(); SP = this; }
private void Awake() { endGame_ref = GameObject.FindGameObjectWithTag("Canvas").GetComponent <EndOfGame>(); }