/// <summary> /// Checks each success swap if the game is over /// </summary> /// <param name="obj"></param> private void Map_SuccessSwap(SuccessSwapEventArgs obj) { if (CheckIfRiddleSolved()) { Victory?.Invoke(); } }
private void EndRound(Victory victory) { string text; switch (victory) { case Victory.Innocents: text = Loc.GetString("The innocents have won!"); break; case Victory.Traitors: text = Loc.GetString("The traitors have won!"); break; default: text = Loc.GetString("Nobody wins!"); break; } _gameTicker.EndRound(text); var restartDelay = 10; _chatManager.DispatchServerAnnouncement(Loc.GetString("Restarting in {0} seconds.", restartDelay)); _checkTimerCancel.Cancel(); Timer.Spawn(TimeSpan.FromSeconds(restartDelay), () => _gameTicker.RestartRound()); }
private void activateWinUI(Victory victoryType) { for (int i = 0; i < 10; i++) { winningText.transform.GetChild(i).GetComponent <TextMeshProUGUI>().text = victoryType.Value; } winningUI.SetActive(true); }
public static void OnVictory() { Victory?.Invoke(); var victoryScreen = Instantiate(VictoryScreen); victoryScreen.GetComponent <EndGame>().score = Score; }
// Sets up references and starts the countdown void Start() { mGameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); mVictory = GameObject.Find("Victory").GetComponent <Victory>(); TimeLimit(); m_Countdown = true; StartCoroutine(TimeCountdown()); }
void Start() { background.SetActive(false); Victory.SetActive(false); Defeat.SetActive(false); Gun.SetActive(false); sword.enabled = false; Attacking = false; isAction = false; playerUI = GameObject.Find("PlayerUI" + photonView.Owner.NickName + photonView.ViewID).GetComponent <PlayerUI>(); gamemanager = GameObject.Find("GameManager"); }
private void btn_NextMove(object sender, EventArgs e) { if (_NewGame) { if (_PreviousStep == _NextStep) { return; } //Thread.Sleep(100); btn_Click(Victory.GetNextCell(this.GetAllCell(), _NextStep), EventArgs.Empty); } }
void btn_Click(object sender, EventArgs e) { try { _NewGame = true; XOObject btn = (sender as XOObject); _PreviousStep = _NextStep; if (!btn.Tag.ToString().Equals("0")) { // _Service.ShowMessage("Недопустимый ход!"); return; } if (_NextStep == 1) { btn.TextToImage("x"); _NextStep = 0; } else { btn.TextToImage("o"); _NextStep = 1; } btn.Tag = 1; SetChange(btn); string rez = Victory.Winner(GetAllText()); if (!string.IsNullOrEmpty(rez)) { _Service.ShowMassege(rez); this.SetAllTag("0"); this.SetAllText(""); if (_NextStep == 1) { SetGemers("X", "0"); } else { SetGemers("0", "X"); } _NewGame = false; // SWSound.Start(); } } catch (Exception ex) { _Service.ShowError(ex.Message); } }
public void CheckVictoryORDeath(HerroTemplate other) { if (Helth <= 0) { Dead?.Invoke(this, new ResultBatle($"герой {Name} побежден")); countDeath++; } if (other.Helth <= 0) { Victory?.Invoke(this, new ResultBatle($"герой {Name} одержал победу")); countVictory++; } }
// Initialize the dictionary of riddles and answers void Start() { mInputText = GameObject.Find("InputField").GetComponent <InputField>(); mRiddleText = GameObject.Find("Riddle Text").GetComponent <Text>(); mSubmitButton = GameObject.Find("Submit Button").GetComponent <Button>(); dict.Add(1, "ONE"); dict.Add(2, "TWO"); dict.Add(3, "THREE"); dict.Add(4, "FOUR"); dict.Add(5, "FIVE"); RandomRiddle(); mVictory = GameObject.Find("Victory").GetComponent <Victory>(); }
private void InflictDamage(ICollection <IMonster> monsterCollection, int damage) { if (Validator.CheckForMarkedTarget(monsterCollection)) { this.collectionOfEnemies.First(monster => monster.IsMarked == true).HealthPoints -= damage; Validator.DetermineAliveProprerty(monsterCollection.First(monster => monster.IsMarked == true)); if (!Validator.CheckIfEnemyIsStillAlive(monsterCollection.First(monster => monster.IsMarked == true))) { CharecterSelector.Player.Experience += monsterCollection.First(monster => monster.IsMarked == true).ExperienceBonus; CharecterSelector.Player.Gold += monsterCollection.First(monster => monster.IsMarked == true).PriceBonus; CharecterSelector.Player.Score += monsterCollection.First(monster => monster.IsMarked == true).Score; Validator.UpdateLevelIfNeeded(CharecterSelector.Player); monsterCollection.First(monster => monster.IsMarked == true).MonsterImg = deadMonster; monsterCollection.First(monster => monster.IsMarked == true).IsMarked = false; } else { monsterCollection.First(monster => monster.IsMarked == true).IsMarked = false; } if (!Validator.CheckForAliveEnemy(monsterCollection)) { if (this.collectionOfEnemies.All(monster => monster.Level == 5)) { MessageBox.Show("Congratulations ! \n You won the game ! \n Thanks for playing "); UpdateScore(CharecterSelector.Player.Name, CharecterSelector.Player.Score); Victory victory = new Victory(); victory.Show(); this.Close(); CharecterSelector.levelSelector.Close(); } else { MessageBox.Show("You won the level !"); this.Close(); CharecterSelector.levelSelector.WindowState = FormWindowState.Normal; } } HeroAttack heroAnimation = new HeroAttack(CharecterSelector.Player); heroAnimation.Show(); if (Validator.CheckForAliveEnemy(monsterCollection)) { artficialInteligence.Start(); } } else { MessageBox.Show("You have not selected a target !"); } }
public void Check() { if (IsEndOfGame()) { if (IsVictory()) { Victory?.Invoke(this, null); } else { GameOver?.Invoke(this, null); } return; } CheckCompleted?.Invoke(this, null); }
public async Task <ActionResult> Update(int id, Victory victory) { if (victory == null) { return(new BadRequestResult()); } var userId = _httpContextAccessor.HttpContext.GetUserId(); var data = await _mediator.Send(new UpdateVictory(id, userId, victory.Name, victory.When, victory.Type)); if (data == false) { return(new NotFoundResult()); } return(new OkResult()); }
// Use this for initialization void Start() { imageClear.SetActive(false); restartText.SetActive(false); if (imageClear != null && door != null) { victoryScript = door.GetComponent <Victory>(); } imageDeath.SetActive(false); if (imageDeath != null && mainCamera != null) { deathScript = mainCamera.GetComponent <Death>(); } }
private void Click(object sender, MouseButtonEventArgs e) { button = (MineField_Button)sender; timer.Start(); ChangeEmotion?.Invoke(this, new EventArgs()); if (!button.Dismantled) { if (button.Mined) { button.SetType(CellType.BombExplode); //Explode?.Invoke(this, new EventArgs()); button.Explode?.Invoke(this, new EventArgs()); } else { Open(button); } } int counter = 0; foreach (MineField_Button b in buttonArray) { if (b.Opened) { counter++; } } if (counter == mineField.Rows * mineField.Columns - mineField.Mines) { mineField.IsEnabled = false; Victory?.Invoke(this, new EventArgs()); timer.Stop(); foreach (MineField_Button b in buttonArray) { if (!b.Dismantled && !b.Opened) { b.SetType(CellType.Flagged); dismantledMines++; DismantledMinesChanged?.Invoke(this, new EventArgs()); } } } }
public void EndMatch(Victory ending) { Debug.Log("EndMatch" + ending); State = GameState.VictoryScreen; EndCanvas.gameObject.SetActive(true); Destructibles.Clear(); WinningPlayer = ending; if (WinningPlayer == Victory.Fixer) { EndCanvas.FixerText.SetActive(true); } else { EndCanvas.DestructorText.SetActive(true); } }
// Update is called once per frame void Update() { if (time > 0) { time--; } if (BotRenderer.activeSelf == false && WinTrigger == 0) { Pause(); status = 1; WinTrigger = 1; EndMsgColor = Victory.GetComponent <Renderer>().material.GetColor("_TintColor"); } if (MyRenderer.activeSelf == false && WinTrigger == 0) { Pause(); status = 1; WinTrigger = 2; EndMsgColor = Death.GetComponent <Renderer>().material.GetColor("_TintColor"); } if (Input.GetKeyDown(KeyCode.Space) && WinTrigger == 0 && time == 0) { time = 50; CreateMyAmmo(); } if (Input.GetKeyDown(KeyCode.F2) && WinTrigger == 0) { CreateBotAmmo(); } if (WinTrigger == 1) { EndMessage(Victory); } else if (WinTrigger == 2) { EndMessage(Death); } }
public void CheckVictory() { // On check si les amoureux sont les seuls restants if (PersonnagesList.FindAll(p => p.Effect == Effect.Lover && p.Alive).Count == PersonnagesList.FindAll(p2 => p2.Alive).Count) { Victory = Victory.Lovers; var embed = new DiscordEmbedBuilder { Title = Texts.Annoucement.LoverVictory, Color = Color.LoveColor }; DiscordChannels[GameChannel.TownText].SendMessageAsync(embed: embed.Build()); } // Si il n'y a pas de loup = la ville gagne var nbWolves = PersonnagesList.FindAll(p => p.GetType() == typeof(Wolf) && p.Alive).Count; if (nbWolves == 0) { Victory = Victory.Town; DiscordChannels[GameChannel.TownText].SendMessageAsync(Texts.Annoucement.TownVictory); } // Si il n'y a que des loups = les loups gagnent if (nbWolves == PersonnagesList.FindAll(p => p.Alive).Count) { Victory = Victory.Wolf; var embed = new DiscordEmbedBuilder { Title = Texts.Annoucement.WolfVictory, Color = Color.WolfColor, ImageUrl = "https://f4.bcbits.com/img/a3037005253_16.jpg" }; DiscordChannels[GameChannel.TownText].SendMessageAsync(embed: embed.Build()); } if (Victory != Victory.None) { Moments.Push(Moment.End); } }
public void AddMovement(Database db, string movement) { Coordinate starting = HouseCoordinatesInterpreter(movement.Substring(0, 2)); Coordinate destination = HouseCoordinatesInterpreter(movement.Substring(3, 2)); IHouse startingHouse = ChessBoard[starting.Column, starting.Row]; IHouse destinationHouse = ChessBoard[destination.Column, destination.Row]; if (startingHouse.PieceInLocation == null || startingHouse.PieceInLocation?.Color != Timer.CurrentPlayerTurn || destinationHouse.PieceInLocation?.Color == Timer.CurrentPlayerTurn || startingHouse.PieceInLocation?.CanMove(starting.Column, starting.Row, destination.Column, destination.Row, ChessBoard.Houses) == false ) { throw new InvalidOperationException("Mossa non valida"); } ChessBoard.MovePiece(startingHouse, destinationHouse); Notes.WriteMovement(db, table, movement); //Check King still alive Color checkDefeatedColor; if (Timer.CurrentPlayerTurn == Color.White) { checkDefeatedColor = Color.Black; } else { checkDefeatedColor = Color.White; } bool reInVita = ChessBoard.KingIsAlive(checkDefeatedColor); if (!reInVita) { Victory.Invoke(ChessBoard, Timer.CurrentPlayerTurn); } Timer.SwitchPlayerTurn(); }
private void checkVictory() { bool isGameOver = false; Victory victoryType = Victory.None; //check each victory condition, return if (exterminationScore >= exterminationVictoryThreshold && !victory) { Debug.Log("extermination victory"); isGameOver = true; victoryType = Victory.Extermination; victoryAudio.Play(); } else if (explorationScore >= explorationVictoryThreshold && !victory) { Debug.Log("exploration victory"); isGameOver = true; victoryType = Victory.Exploration; victoryAudio.Play(); } else if (fishingScore >= fishingVictoryThreshold && !victory) { Debug.Log("fishing victory"); isGameOver = true; victoryType = Victory.Fishing; victoryAudio.Play(); } if (isGameOver) { VictoryMessage(victoryType); /* * Time.timeScale = 0; */ } }
IEnumerator Merit() { yield return(new WaitForSeconds(Pause * 2)); M1.SetActive(true); yield return(new WaitForSeconds(Pause)); M2.SetActive(true); yield return(new WaitForSeconds(Pause)); M3.SetActive(true); yield return(new WaitForSeconds(Pause)); M4.SetActive(true); yield return(new WaitForSeconds(Pause)); M5.SetActive(true); yield return(new WaitForSeconds(Pause * 2)); Victory.SetActive(true); yield return(new WaitForSeconds(Pause * 2)); Application.LoadLevel("Credits"); }
private void EndRound(Victory victory) { string text; switch (victory) { case Victory.Innocents: text = "The innocents have won!"; break; case Victory.Traitors: text = "The traitors have won!"; break; default: text = "Nobody wins!"; break; } _gameTicker.EndRound(text); _chatManager.DispatchServerAnnouncement($"Restarting in 10 seconds."); _checkTimerCancel.Cancel(); Timer.Spawn(TimeSpan.FromSeconds(10), () => _gameTicker.RestartRound()); }
public Win(Victory victory, bool perfect) { m_victory = victory; m_isperfect = perfect; }
public void startCountdown(Vector3 poi, Victory victory, Player winner ) { countdownPanel.gameObject.SetActive(true); victoryCondition.text = string.Format("{0}: {1}", victory.ToString(), winner);//DataManager.Instance.playerDatas[winner].name); //countdownText.setTimer( victory.countdownTime(), () => { winPanel.SetActive(true); }); countdownText.setTimer( victory.countdownTime(), () => { GameController.Instance.ToGameStatistics(poi, winner, Victory.MapControl); /*gameMenu.GetComponent<GameMenuBehaviour>().EndGameMenu ( poi, winner.Equals(Player.Player), "All objectives controlled" );*/ }); }
public async Task <Victory> Add(Victory victory) { var userId = _httpContextAccessor.HttpContext.GetUserId(); return(await _mediator.Send(new AddVictory(userId, victory.Name, victory.When, victory.Type))); }
private void ServerMessageReceiver(NetworkMessage NetMsg) { StringMessage msg = new StringMessage(); msg.value = NetMsg.ReadMessage <StringMessage>().value; string[] deltas = msg.value.Split('|'); switch (deltas[0]) { case "Player": int ToSetID; if (Int32.TryParse(deltas[1], out ToSetID)) { PlayerID = ToSetID; PlayersImages[PlayerID - 1].SetActive(true); ConnectButton.SetActive(false); Scene2UI.transform.GetChild(0).GetChild(PlayerID).gameObject.SetActive(true); SoundManager.GetInstance().PlaySound(0); } break; case "Start": SoundManager.GetInstance().PlaySound(1); Scene1UI.SetActive(true); Scene2UI.SetActive(false); PlayersImages[PlayerID - 1].SetActive(false); Scene1 = true; break; case "Scene1": SoundManager.GetInstance().SetRandom(true); DeactivateMinigames(); Scene1UI.SetActive(true); Scene2UI.SetActive(false); Scene1 = true; break; case "Scene2": SoundManager.GetInstance().SetRandom(true); DeactivateMinigames(); Scene1UI.SetActive(false); Scene2UI.SetActive(true); Scene1 = false; break; case "Fallen": SoundManager.GetInstance().SetRandom(false); SoundManager.GetInstance().PlaySound(2); CurrentMinigame = UnityEngine.Random.Range(0, MiniGames.Length); MiniGames[CurrentMinigame].SetActive(true); MiniGames[CurrentMinigame].GetComponent <MinigameScript>().Restart(); Scene1UI.SetActive(false); Scene2UI.SetActive(false); break; case "GotUp": SoundManager.GetInstance().SetRandom(true); SoundManager.GetInstance().PlaySound(3); DeactivateMinigames(); if (Scene1) { Scene1UI.SetActive(true); } else { Scene2UI.SetActive(true); } break; case "Won": SoundManager.GetInstance().PlaySound(6); DeactivateMinigames(); Scene1UI.SetActive(false); Scene2UI.SetActive(false); Victory.SetActive(true); break; case "Lost": SoundManager.GetInstance().PlaySound(7); DeactivateMinigames(); Scene1UI.SetActive(false); Scene2UI.SetActive(false); Defeat.SetActive(true); break; default: Debug.Log("Message"); break; } }
public void stopCountdown(Victory victory) { countdownPanel.gameObject.SetActive(false); countdownText.stop(); }
public Win(Victory victory, Boolean perfect) { m_victory = victory; m_isperfect = perfect; }
public void Awake() { instance = this; }
// Use this for initialization void Start() { victoryComponent = FindObjectOfType <Victory> (); }
private void Start() { victory = Victory.Instance; }
public static void OnVictory() => Victory?.Invoke();
public void ToGameStatistics(Vector3 poi, Player winner, Victory winCondition) { Vector3 newCameraPosition; Ray ray = new Ray(Camera.main.transform.position, Camera.main.transform.forward); RaycastHit hit; if (Physics.Raycast ( ray, out hit, Mathf.Infinity // max distance ) ) { newCameraPosition = poi + (Camera.main.transform.position - hit.point); } else { throw new UnityException("POI isn't over ground!"); } Camera.main.transform.position = newCameraPosition; StartCoroutine(ToGameStatisticsIEnumerator(winner, winCondition)); }
IEnumerator ToGameStatisticsIEnumerator(Player winner, Victory winCondition) { GameStatistics.winner = winner; GameStatistics.winCondition = winCondition; yield return new WaitForSeconds(3); Application.LoadLevel("EndGameScene"); }
public void OnVictory() { Victory?.Invoke(this); }