Example #1
0
        private WorldState world; //the world we are viewing

        #endregion Fields

        #region Constructors

        public WorldInputHandler(Vector2 topLeft, Vector2 size, WorldState world)
        {
            speed = 0;
            this.topLeft = topLeft;
            this.size = size;
            location = new Vector2(0, 0);
            dragging = false;
            following = false;
            this.world = world;
            buttons = new List<Button>();
            buttons.Add(new MenuButton(new Vector2(1, 1)));
            buttons.Add(new SlowDownButton(new Vector2(Display.measureString("Speed:        ").X, 55), this));
            buttons.Add(new SpeedUpButton(new Vector2(Display.measureString("Speed:        x00 ").X + 35 + 5, 55), this));
            buttons.Add(new ViewMoreInfoButton(new Vector2(Display.getWindowWidth() - (110 + ((Display.getWindowWidth() - 800) / 2)), Display.getWindowHeight() - 130), this));
            buttons.Add(new KillButton(this, new Vector2(Display.getWindowWidth() - (110 + ((Display.getWindowWidth() - 800) / 2)) - buttons[3].getWidth() - 5, Display.getWindowHeight() - 130)));
            buttons.Add(new CloneButton(this, new Vector2(Display.getWindowWidth() - (110 + ((Display.getWindowWidth() - 800) / 2)) - buttons[3].getWidth() - 5 - buttons[4].getWidth() - 5, Display.getWindowHeight() - 130)));
            drawer = new WorldDrawer(this);
            buttons[3].setVisible(false);
            buttons[4].setVisible(false);
            buttons[5].setVisible(false);
            start = false;
        }
Example #2
0
 /// <summary>
 /// Sets the world of the creature to a given world
 /// </summary>
 /// <param name="world">The world to add the creature to</param>
 public void setWorld(WorldState world)
 {
     this.world = world;
 }
Example #3
0
 /// <summary>
 /// Initialises the necessary parts of the Simulation
 /// </summary>
 protected override void Initialize()
 {
     base.Initialize();
     this.IsMouseVisible = true;
     theWorld = null;
     state = new InitialisationState();
 }
Example #4
0
 /// <summary>
 /// Begins the world state simulation, generating a new world and setting it to the current state
 /// </summary>
 /// <param name="creatureList">The list of creatures to add to the new world</param>
 /// <param name="seed">The seed of the random number generator to add to the world</param>
 public static void begin(List<Creature> creatureList, int seed)
 {
     theWorld = new WorldState(seed, creatureList);
     state = theWorld;
 }