Example #1
0
 public Giocatore(string name, Color color, SecretGoal goal, int armateDaAssegnare)
 {
     this._name              = name;
     this._color             = color;
     this._goal              = goal;
     this._armateDaAssegnare = armateDaAssegnare;
 }
        public HfGainsSecretGoal(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "hfid": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "secret_goal":
                    switch (property.Value)
                    {
                    case "immortality": Goal = SecretGoal.Immortality; break;

                    default:
                        Goal         = SecretGoal.Unknown;
                        _unknownGoal = property.Value;
                        world.ParsingErrors.Report("Unknown Secret Goal: " + _unknownGoal);
                        break;
                    }
                    break;
                }
            }

            HistoricalFigure.AddEvent(this);
        }
Example #3
0
        internal override void Export(string table)
        {
            base.Export(table);

            table = GetType().Name;

            var vals = new List <object>
            {
                Id,
                HfId.DBExport(),
                SecretGoal.DBExport(HistoricalFigure.Goals)
            };

            Database.ExportWorldItem(table, vals);
        }
    public List <Giocatore> Create(string[] playerNames, List <StatoController> states)
    {
        this.armateIniziali = (armatePerStato - 1) * states.Count / playerNames.Length;
        //Ne metto una in meno da assegnare perchè ne inserisco una direttamente per evitare inconsistenze
        GoalReachedManager goalReachedManager = GoalReachedManager.GetInstance();

        for (int i = 0; i < playerNames.Count(); i++)
        {
            Color      color     = colors[i];
            SecretGoal secret    = goalReachedManager.GenerateGoal();
            Giocatore  giocatore = new Giocatore(playerNames[i], color, secret, this.armateIniziali);
            secret.Player = giocatore;

            players.Add(giocatore);
        }

        int num, cont = 0, j = 0;

        while (temp.Count < states.Count)
        {
            num = randomStates.Next(states.Count);

            if (!temp.Contains(num))
            {
                temp.Add(num);

                states[num].Player      = players[j];
                states[num].TankNumber += 1;
                cont++;

                if (cont == (states.Count / playerNames.Length))
                {
                    cont = 0;
                    j++;
                }
            }
        }

        return(players);
    }