Beispiel #1
0
        /// <summary>
        /// Creates a city and initialize's it with the given sides
        /// </summary>
        /// <param name="name">Name of the city</param>
        public City(string name)
        {
            //System.Media.SoundPlayer sp = new System.Media.SoundPlayer("../Media/a.wav");
            //System.Diagnostics.Debug.WriteLine("I REGRET NOTHING");
            //sp.PlayLooping();
            this.name = name;
            this.grid = new InfiniteGrid();

            this.pipes    = new List <Links>();
            this.Citizens = new List <Person>();
            this.weather  = new Weather();

            initResources();
        }
Beispiel #2
0
        public void GetConnections()
        {
            InfiniteGrid grid = Haswell.Controller.City.Grid;
            Point        loc  = new Point(this.Parent.X, this.Parent.Y);

            if (this.GetType() == grid.ElementAt(loc.X + 1, loc.Y).Building.GetType())
            {//North
                this.connections[0] = (Road)grid.ElementAt(loc.X + 1, loc.Y).Building;
            }
            if (this.GetType() == grid.ElementAt(loc.X, loc.Y + 1).Building.GetType())
            {//East
                this.connections[1] = (Road)grid.ElementAt(loc.X, loc.Y + 1).Building;
            }
            if (this.GetType() == grid.ElementAt(loc.X - 1, loc.Y).Building.GetType())
            {//South
                this.connections[2] = (Road)grid.ElementAt(loc.X - 1, loc.Y).Building;
            }
            if (this.GetType() == grid.ElementAt(loc.X, loc.Y - 1).Building.GetType())
            {//West
                this.connections[3] = (Road)grid.ElementAt(loc.X, loc.Y - 1).Building;
            }
        }
Beispiel #3
0
 internal Plot(int x, int y, InfiniteGrid grid)
 {
     this.grid = grid;
     initialize(x, y);
     this.resource = new ResourceDict();
 }