Exemplo n.º 1
0
        private void GameEnd_NewGamed(object sender, EventArgs e)
        {
            GameStarted                  = false;
            GameFinished                 = false;
            GameEnd.Visibility           = Visibility.Collapsed;
            WhiteOffer.Visibility        = Visibility.Collapsed;
            BlackOffer.Visibility        = Visibility.Collapsed;
            WhiteConfirmation.Visibility = Visibility.Collapsed;
            BlackConfirmation.Visibility = Visibility.Collapsed;
            Game = new GameHandler();

            MoveHistoryGrid.Children.Clear();
            MoveHistoryGrid.ColumnDefinitions.Clear();
            MoveHistoryGrid.RowDefinitions.Clear();

            LastMove = ((-1, -1), (-1, -1));
            MoveButtons.Clear();
            LastSound.Clear();
            LastSound.Add("White", new List <string>());
            LastSound.Add("Black", new List <string>());

            whiteTimer = null;
            blackTimer = null;

            WhiteTimeTextBlock.Text = "";
            BlackTimeTextBlock.Text = "";

            RenderModels(Game.Board);
            RenderCapturedPieces();
        }
Exemplo n.º 2
0
    // Update is called once per frame
    private void Update()
    {
        if (_takenGuess && _lastSound != null)
        {
            if (!_takenGuessRight)
            {
                Helper.text  = $"Wrong! It was {_lastSound.Direction} {_lastSound.Distance}.";
                Helper.color = Color.red;
            }
            else
            {
                Helper.text  = $"Correct! It was {_lastSound.Direction} {_lastSound.Distance}.";
                Helper.color = Color.green;
            }
        }

        if (Time.time > _nextFire && _takenGuess)
        {
            var dist = (Distance)Random.Range(0, 2);
            var idx  = Random.Range(0, _soundsTunnels.Length);

            var dir = _soundsTunnels[idx].Direction;
            //Debug.Log($"Fired {dir} at distance {dist}.");

            _soundsTunnels[idx].Fire(dist);



            _nextFire        = Time.time + _fireRate;
            _takenGuess      = false;
            _takenGuessRight = false;

            _lastSound = new LastSound {
                Distance  = dist,
                Direction = dir
            };
        }

        ScoreValue.text = _currentScore.ToString();
    }