Exemple #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());
        }
    }
Exemple #2
0
        static void sendDecesion()
        {
            //send Decision
            if (clientlist.Count >= 1)
            {
                Decision newDecision = DecisionPool.GetDecision(planets[0]);

                //Console.WriteLine("new Decision :" + newDecision.ToMessageString());

                BroadcastMeseage(newDecision.ToMessageString());
            }
        }