Exemplo n.º 1
0
 public void AddPlayerOneByOne(PlayerDto playerDto)
 {
     if (playerDto != null)
     {
         PlayerInfo.Add(playerDto);
     }
 }
Exemplo n.º 2
0
        internal void ComputeMapInfo(Game game)
        {
            foreach (Pheromone pheromone in game.Pheromones.AllPhromones)
            {
                MapPheromone mapPheromone = new MapPheromone();
                mapPheromone.Pos = pheromone.Pos;

                mapPheromone.IntensityToHome    = pheromone.GetIntensityF(0, PheromoneType.ToHome);
                mapPheromone.IntensityToMineral = pheromone.GetIntensityF(0, PheromoneType.ToFood);
                mapPheromone.IntensityToEnemy   = pheromone.GetIntensityF(0, PheromoneType.Enemy);

                foreach (PheromoneItem pheromoneItem in pheromone.PheromoneItems)
                {
                    MapPheromoneItem mapPheromoneItem = new MapPheromoneItem();

                    mapPheromoneItem.PlayerId      = pheromoneItem.PlayerId;
                    mapPheromoneItem.PheromoneType = pheromoneItem.PheromoneType;
                    mapPheromoneItem.Intensity     = pheromoneItem.Intensity;
                    mapPheromoneItem.IsStatic      = pheromoneItem.IsStatic;

                    mapPheromone.PheromoneItems.Add(mapPheromoneItem);
                }
                Pheromones.Add(mapPheromone.Pos, mapPheromone);
            }

            foreach (Tile t in game.Map.Tiles.Values)
            {
                TotalMetal += t.Metal;
                if (t.Unit != null)
                {
                    int unitMetal = t.Unit.CountMetal();
                    TotalMetal += unitMetal;

                    MapPlayerInfo mapPlayerInfo;
                    if (PlayerInfo.ContainsKey(t.Unit.Owner.PlayerModel.Id))
                    {
                        mapPlayerInfo = PlayerInfo[t.Unit.Owner.PlayerModel.Id];
                    }
                    else
                    {
                        mapPlayerInfo = new MapPlayerInfo();
                        PlayerInfo.Add(t.Unit.Owner.PlayerModel.Id, mapPlayerInfo);
                    }
                    mapPlayerInfo.TotalMetal += unitMetal;
                    mapPlayerInfo.TotalUnits++;
                }
            }

            /*
             * if (checkTotalMetal != 0)
             * {
             *  if (checkTotalMetal != mapInfo.TotalMetal)
             *  {
             *      //throw new Exception("Metal changed");
             *  }
             * }*/
        }
Exemplo n.º 3
0
    // Called when the character select screen has selected characters
    public void CharacterSelectionComplete(List <string> names, List <int> spriteIndexes)
    {
        for (int i = 0; i < names.Count; ++i)
        {
            PlayerInfo.Add(new PlayerInfo(names[i], spriteIndexes[i]));
        }

        levelManager.TransitionComplete += TransitionCompleted;

        levelManager.MoveToDisplayResults();
    }