Esempio n. 1
0
    private void Tick()
    {
        if (currentDecision != null)
        {
            if (!(currentDecision.GetVotesYes() + currentDecision.GetVotesNo() < players.Count))
            {
                if (currentDecision.GetVotesYes() > currentDecision.GetVotesNo())
                {
                    effects.Add(currentDecision.GetEffect());
                    this.MapDecisionToPlanetStats(effects[0]);
                }


                currentDecision = null;
            }
            else if (currentDecision.remainingTicks != 0)
            {
                currentDecision.remainingTicks--;
            }
            else
            {
                if (currentDecision.GetVotesYes() > currentDecision.GetVotesNo())
                {
                    effects.Add(currentDecision.GetEffect());
                    this.MapDecisionToPlanetStats(effects[0]);
                }

                currentDecision = null;
            }
        }

        if (ticks == UTIL.GetMaxPlanetTick())
        {
            ticks           = 0;
            currentDecision = DecisionPool.GetDecision(this);

            SendDecision(currentDecision);
        }
        else
        {
            ticks++;

            for (int i = 0; i < effects.Count; i++)
            {
                effects[i].Do(this);
                if (effects[i].GetTicks() - 1000 == 0)
                {
                    effects.Remove(effects[i]);
                    i--;
                }
            }
        }

        foreach (Player p in players)
        {
            p.GetClient().SendMessage(ToMessageString());
        }
    }