/// <summary> /// Sets up the Drawer, getting all the necessary textures etc. from Display and storing them and associates the /// drawer with a WorldInputHandler /// </summary> /// <param name="inputHandler">The WorldInputHandler that forms an intermediate step between the Drawer and the actual world model</param> public WorldDrawer(WorldInputHandler inputHandler) { this.inputHandler = inputHandler; creatureTile = Display.getTexture(TextureNames.CREATURE); plantTile = Display.getTexture(TextureNames.PLANT); remainsTile = Display.getTexture(TextureNames.REMAINS); obstacleTile = Display.getTexture(TextureNames.OBSTACLE); emptyTile = Display.getTexture(TextureNames.EMPTY); topBar = Display.getTexture(TextureNames.TOP); viewBack = Display.getTexture(TextureNames.VIEWBACK); depletedPlantTile = Display.getTexture(TextureNames.PLANT_DEPLETED); spriteBatch = Display.getSpriteBatch(); spriteFont = Display.getFont(); }
/// <summary> /// Sets up the world, performing all actions common to all the constructors /// </summary> public void setUpWorld() { Vector2 TL = new Vector2(0, 150); //The top left of that area to actually draw the world in inputHandler = new WorldInputHandler(TL, new Vector2(1024 - TL.X, 768 - TL.Y), this); deadList = new Stack<Creature>(); plantList = new List<Plant>(); remainsList = new List<Remains>(); tiles = new Tile[worldX][]; for (int i = 0; i < worldX; i++) { tiles[i] = new Tile[worldY]; for (int j = 0; j < worldY; j++) { tiles[i][j] = new Tile(); } } populateWorld(); }
/// <summary> /// Sets up the button with all the required variables /// </summary> /// <param name="topLeft">The location of the top left of the button as a Vector2</param> /// <param name="inputHandler">The inputHandler to associate with this object</param> public SlowDownButton(Vector2 topLeft, WorldInputHandler inputHandler) : base(topLeft, new Vector2(35,35), TextureNames.SLOWDOWN) { this.inputHandler = inputHandler; }
/// <summary> /// Sets up the clone button, sets the size to the size of the texture for the clone button, and the texture to the correct one for the clone button /// requires the location and the WorldInputHandler to be associated with /// </summary> /// <param name="input">The WorldInputHandler to be associated with this button</param> /// <param name="topLeft">The location of this button as a Vector2 representing where the top left of the button is</param> public CloneButton(WorldInputHandler input, Vector2 topLeft) : base(topLeft, new Microsoft.Xna.Framework.Vector2(30, 30), TextureNames.CLONE) { this.input = input; }
/// <summary> /// Sets up the button with all the required variables /// </summary> /// <param name="topLeft">The location of the button as a Vector2</param> /// <param name="input">The WorldInputHandler associated with this button</param> public ViewMoreInfoButton(Vector2 topLeft, WorldInputHandler input) : base(topLeft, new Vector2(100 , 30), TextureNames.MOREINFO) { this.inputHandler = input; }
/// <summary> /// Sets up the kill button, sets its size and texture to those associated with the kill button, takes the location and the inputhandler to /// associate the button with /// </summary> /// <param name="input">The WorldInputHandler to associate this button with</param> /// <param name="topLeft">The location to place this button as a Vector2</param> public KillButton(WorldInputHandler input, Vector2 topLeft) : base(topLeft, new Vector2(30, 30), TextureNames.KILL) { this.input = input; }
/// <summary> /// Sets up the button with all the required variables /// </summary> /// <param name="topLeft">The location of the top left of the button as a Vector2</param> /// <param name="inputHandler">The inputHandler to associate with this object</param> public SpeedUpButton(Vector2 topLeft, WorldInputHandler inputHandler) : base(topLeft, new Vector2(35, 35), TextureNames.SPEEDUP) { this.inputHandler = inputHandler; }