Ejemplo n.º 1
0
        //Run the game
        public List <Player> Run()
        {
            int roundCount = 1;

            //Create new rounds until three rounds total have been washes (no coins exchange hands)
            while (RoundWashCount < 3)
            {
                OnNewRound?.Invoke(roundCount);
                NonBlockingSleep(1);

                WriteLine("");
                WriteLine("------------- Round " + roundCount + " -----------");

                if (RunRound())
                {
                    //If the round ends as a wash, increment the counter
                    RoundWashCount++;
                    WriteLine("Current number of washes: " + RoundWashCount);
                }
                roundCount++;
                Players.Add(Players.Pull(0));//move the current player to the end of the line

                if (roundCount > 50)
                {
                    break;                  //prevent games from lasting forever
                }
            }
            EndGame();
            return(Winners);
        }
Ejemplo n.º 2
0
    private IEnumerator ScoreRoutine()
    {
        Time.timeScale = 0;
        yield return(new WaitForSecondsRealtime(Loader.i.settings.WaitAfterScore));

        Time.timeScale = 1;
        OnNewRound.Invoke();
    }
Ejemplo n.º 3
0
    private IEnumerator Start()
    {
        GameState.OnStateChange.AddListener(OnStateUpdate);
        yield return(new WaitForEndOfFrame());

        OnNewRound.Invoke();
        OnNewGame.Invoke();
    }
Ejemplo n.º 4
0
        public IEnumerator NewRoundCoroutine()
        {
            yield return(new WaitForEndOfFrame());

            OnNewRoundHandler?.Invoke(_round);

            //_round.OnRoundBeginHandler += _currentLevel.OnBeginRound;

            _round.OnRoundEndHandler += OnRoundEnd;

            _round.BeginIntermission();

            yield return(null);
        }
Ejemplo n.º 5
0
 private void NextRound()
 {
     currentRound++;
     foreach (var unit in Unit.All)
     {
         unit.turnTaken = false;
     }
     RefreshActiveUnitNumbers();
     OnNewRound?.Invoke(this, EventArgs.Empty);
     currentGangTurn = NextGangTurn();
     _infoBar.SetPlayerTurn(currentRound, playerNames[currentGangTurn]);
     if (currentGangTurn == gangNumber)
     {
         StartUnitTurn(FindNextUnit());
     }
 }
Ejemplo n.º 6
0
    private IEnumerator WinRoutine()
    {
        Time.timeScale = 0;
        yield return(new WaitForSecondsRealtime(Loader.i.settings.WaitAfterWin));

        GameState.UpdateState(s =>
        {
            if (s.p1score > s.p2score)
            {
                s.p1wins++;
            }
            else
            {
                s.p2wins++;
            }
            s.p1score = s.p2score = 0;
        });
        Time.timeScale = 1;

        OnNewGame.Invoke();
        OnNewRound.Invoke();
    }
Ejemplo n.º 7
0
 public void RpcOnNewRound()
 {
     endedRound = false;
     if (!isLocalPlayer)
     {
         if (SelectedCoin != null)
         {
             SelectedCoin.Hidden = true;
         }
     }
     else
     {
         GetComponentInChildren <EndTurnButton>().OnNewRound();
     }
     foreach (Coin coin in coins)
     {
         coin.OnNewRound();
     }
     SelectedCoin = null;
     GetComponent <PlayerSetup>().AssignCoinsSymbols();
     onNewRound?.Invoke();
     DisplayText("Choose a coin");
 }
Ejemplo n.º 8
0
 public void NewRound()
 {
     _currPlanetSpecification = new PlanetSpecification();
     OnNewRound?.Invoke(_currPlanetSpecification);
 }
Ejemplo n.º 9
0
 private void Evaluate(GameObject sprite)
 {
     audioManager.PlayEnvironmentSound("Selection");
     OnNewRound.Invoke(sprite.GetComponent <SpriteRenderer>().sprite == targetSprite);
 }