Inheritance: MonoBehaviour
Exemplo n.º 1
0
 /// <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();
     }
 }
Exemplo n.º 2
0
        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());
        }
Exemplo n.º 3
0
 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;
    }
Exemplo n.º 5
0
 // 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());
 }
Exemplo n.º 6
0
 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");
 }
Exemplo n.º 7
0
 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);
     }
 }
Exemplo n.º 8
0
        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);
            }
        }
Exemplo n.º 9
0
 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++;
     }
 }
Exemplo n.º 10
0
    // 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>();
    }
Exemplo n.º 11
0
 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 !");
     }
 }
Exemplo n.º 12
0
 public void Check()
 {
     if (IsEndOfGame())
     {
         if (IsVictory())
         {
             Victory?.Invoke(this, null);
         }
         else
         {
             GameOver?.Invoke(this, null);
         }
         return;
     }
     CheckCompleted?.Invoke(this, null);
 }
Exemplo n.º 13
0
        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());
        }
Exemplo n.º 14
0
    // 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>();
        }
    }
Exemplo n.º 15
0
        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());
                    }
                }
            }
        }
Exemplo n.º 16
0
    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);
        }
    }
Exemplo n.º 17
0
    // 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);
        }
    }
Exemplo n.º 18
0
        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);
            }
        }
Exemplo n.º 19
0
        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();
        }
Exemplo n.º 20
0
    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;
             */
        }
    }
Exemplo n.º 21
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");
    }
Exemplo n.º 22
0
        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());
        }
Exemplo n.º 23
0
 public Win(Victory victory, bool perfect)
 {
     m_victory   = victory;
     m_isperfect = perfect;
 }
Exemplo n.º 24
0
 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"
         );*/
     });
 }
Exemplo n.º 25
0
        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)));
        }
Exemplo n.º 26
0
    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;
        }
    }
Exemplo n.º 27
0
 public void stopCountdown(Victory victory)
 {
     countdownPanel.gameObject.SetActive(false);
     countdownText.stop();
 }
Exemplo n.º 28
0
		public Win(Victory victory, Boolean perfect)
		{
			m_victory = victory;
			m_isperfect = perfect;
		}
Exemplo n.º 29
0
 public void Awake()
 {
     instance = this;
 }
Exemplo n.º 30
0
 // Use this for initialization
 void Start()
 {
     victoryComponent = FindObjectOfType <Victory> ();
 }
Exemplo n.º 31
0
 private void Start()
 {
     victory = Victory.Instance;
 }
Exemplo n.º 32
0
 public static void OnVictory() => Victory?.Invoke();
Exemplo n.º 33
0
    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));
    }
Exemplo n.º 34
0
    IEnumerator ToGameStatisticsIEnumerator(Player winner, Victory winCondition)
    {
        GameStatistics.winner = winner;
        GameStatistics.winCondition = winCondition;

        yield return new WaitForSeconds(3);

        Application.LoadLevel("EndGameScene");
    }
Exemplo n.º 35
0
 public void OnVictory()
 {
     Victory?.Invoke(this);
 }