コード例 #1
0
        /// <summary>
        /// Determine the SetUp on a bomb site
        /// </summary>
        /// <param name="Players"></param>
        /// <param name="mapInfo"></param>
        public void DetermineSetUp(List <PlayerBombSite> Players, Map_JSON mapInfo, BombSite site)
        {
            this.Site = site;

            float BombSiteX;
            float BombSiteY;

            // Get the bomb site information
            if (site == BombSite.A)
            {
                BombSiteX = mapInfo.bombA_x;
                BombSiteY = mapInfo.bombA_y;
            }
            else
            {
                BombSiteX = mapInfo.bombB_x;
                BombSiteY = mapInfo.bombB_y;
            }

            // We need to find a better measure but we say that a player is a player of a
            // bomb site if he is at a distance inferior to the bombsite

            // Iterate over the players to determine their site
            foreach (PlayerBombSite p in Players)
            {
                if (Distance(new Vector(BombSiteX, BombSiteY, 0), p.Position,
                             mapInfo.pos_x, mapInfo.pos_y, mapInfo.scale) < 0.3f)
                {
                    // The player is a player of this bombsite
                    if (Program.VERBOSE)
                    {
                        Console.WriteLine("{0} is a player of {1} bombsite", p.Name, site);
                    }
                    players.Add(new PlayerBombSite(p));
                }
            }
        }
コード例 #2
0
 public SetUp(BombSite site, List <PlayerBombSite> players)
 {
     Site         = site;
     this.players = players;
 }