Ejemplo n.º 1
0
        public override void ActivatePanel(bool isRecursive)
        {
            base.ActivatePanel(isRecursive);

            /* It is gauranteed that the selected entity is a single person. */
            person = (Person)World.SelectedEntities.First();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            gameWindow = new Rectangle(0, 0, this.graphics.GraphicsDevice.Viewport.Width,
                    this.graphics.GraphicsDevice.Viewport.Height);

            base.Initialize();

            MouseController.Initialize();
            KeyController.Initialize();

            MouseController.AddMouseListener(this);
            MouseController.AddMouseMotionListener(this);
            MouseController.AddMouseScrollListener(this);
            KeyController.AddKeyListener(this);

            Display.InitializeDisplay(new Dimension(100, 50), new Point(0, 25), new Dimension(900, 600), new Rectangle(0, 25, 900, 425));
            World.InitalizeWorld(20, 18);
            Layer.Initialize();

            informationPanel = new InformationPanel(new Rectangle(5, 445, 890, 150));
            missionPanel = new MissionPanel(new Rectangle(0, 25, 300, 200));
            menuBar = new MenuBar(new Rectangle(0, 0, 900, 25));
            worldStatsBar = new WorldStatsPanel(new Rectangle(800, 25, 95, 100));

            Tree t1 = new Tree(2, 1);
            t1.Direction = Entity.DirectionType.East;
            World.AddEntity(t1);

            Tree t2 = new Tree(4, 5);
            t2.Direction = Entity.DirectionType.East;
            World.AddEntity(t2);

            Tree t3 = new Tree(9, 9);
            t3.Direction = Entity.DirectionType.North;
            World.AddEntity(t3);

            World.AddEntity(new School(6, 6));
            World.AddEntity(new Factory(8, 3));
            World.AddEntity(new ResearchCenter(1, 7));
            World.AddEntity(new Hospital(4, 10));

            Random random = new Random();

            Person p0 = new Person(2, 3);
            Person p1 = new Person(4, 6);
            Person p2 = new Person(6, 7);
            Person p3 = new Person(4, 7);
            Person p4 = new Person(6, 1);
            Person p5 = new Person(6, 9);
            Person p6 = new Person(7, 9);
            p0.Direction = Entity.DirectionType.South;
            p3.Profession = Person.ProfessionType.Educator;
            p3.Education = 3;
            p3.Direction = Entity.DirectionType.West;
            p2.Direction = Entity.DirectionType.West;
            p5.Direction = Entity.DirectionType.West;
            p6.Direction = Entity.DirectionType.West;
            p5.Profession = Person.ProfessionType.Educator;
            p6.Profession = Person.ProfessionType.Scientist;
            p5.Education = 3;
            p5.Health = 5;
            p6.Education = 3;
            World.AddEntity(p0);
            World.AddEntity(p1);
            World.AddEntity(p2);
            World.AddEntity(p3);
            World.AddEntity(p4);
            World.AddEntity(p5);
            World.AddEntity(p6);

            Mirror m1 = new Mirror(2, 4);
            Mirror m2 = new Mirror(5, 4);
            m1.Reflection = Mirror.ReflectionType.SouthWest;
            m2.Reflection = Mirror.ReflectionType.NorthEast;
            World.AddEntity(m1);
            World.AddEntity(m2);
        }
Ejemplo n.º 3
0
        public static Person MovePerson(Person person, Point newLocation)
        {
            if (IsClear(newLocation.X, newLocation.Y)) {
                Grid[person.GridLocation.X, person.GridLocation.Y].RemoveEntity(person);
                Grid[newLocation.X, newLocation.Y].AddEntity(person);
                person.Move(newLocation.X, newLocation.Y);
            }

            return person;
        }
Ejemplo n.º 4
0
 public ProfessionCondition(Person.ProfessionType professionType, int comparisonValue, int comparisonType)
     : base(comparisonValue, comparisonType)
 {
     this.professionType = professionType;
 }