public UnitBase(SpriteBatch spriteBatch, Game game, Camera2D cam, MouseHandler mH) { selectionTexture = game.Content.Load<Texture2D>("UtilityTextures/SBox"); this.spriteBatch = spriteBatch; this.cam = cam; this.mH = mH; oType = "unitbase"; }
public MinionBase(SpriteBatch spriteBatch, Game game, Camera2D cam, MouseHandler mH) : base(spriteBatch, game, cam, mH) { Image = game.Content.Load<Texture2D>("KC_Pong"); ImageRec = new Rectangle((int)Position.X, (int)Position.Y, Image.Width, Image.Height); Position = new Vector2(50, 50); OType = "minionbase"; Health = 100; ui = new UI(game, spriteBatch, cam, mH, this); unitName = "Minion!"; }
//**************************************** // THIS IS FOR THE MINION CLASS //**************************************** public UI(Game game, SpriteBatch spriteBatch, Camera2D cam, MouseHandler mH, MinionBase m) { this.game = game; this.spriteBatch = spriteBatch; this.cam = cam; this.mH = mH; pos = new Vector2(m.Position.X, m.ImageRec.Height); progBox = game.Content.Load<Texture2D>("UtilityTextures/RedBox"); healthBox = game.Content.Load<Texture2D>("UtilityTextures/RedBox"); size = new Rectangle((int)m.Position.X, (int)m.Position.Y, m.ImageRec.Width / 10, 10); sBar = new StatusBar(m.Position, healthBox, health, size, "Right", spriteBatch, cam); //font spriteName = game.Content.Load<SpriteFont>("menufont"); fontLoc = new Vector2(m.Position.X, m.Position.Y - 10); name = m.UnitName; }
public Building(SpriteBatch spriteBatch, Game game, Camera2D cam, MouseHandler mH) : base(spriteBatch, game, cam, mH) { Image = game.Content.Load<Texture2D>("CPU_Pong"); ImageRec = new Rectangle((int)Position.X, (int)Position.Y, Image.Width, Image.Height); unitName = "test"; uniqueName = "101"; OType = "building"; Health = 100; bList = BuildingList.Barracks; bUL = new BandUList(game, spriteBatch, cam, this.Image, this.Position, bList); uI = new UI(game, spriteBatch, cam, mH, this); this.spriteBatch = spriteBatch; this.game = game; this.cam = cam; this.mH = mH; }
//**************************************** // THIS IS FOR THE BUILDING CLASS //**************************************** public UI(Game game, SpriteBatch spriteBatch, Camera2D cam, MouseHandler mH, Building b) { this.game = game; this.spriteBatch = spriteBatch; this.cam = cam; this.mH = mH; pos = new Vector2(b.Position.X, b.ImageRec.Height); size = new Rectangle((int)b.Position.X, (int)b.Position.Y, b.ImageRec.Width / 10, 10); progBox = game.Content.Load<Texture2D>("UtilityTextures/RedBox"); healthBox = game.Content.Load<Texture2D>("UtilityTextures/RedBox"); sBar = new StatusBar(pos, healthBox, health, size, "Right", spriteBatch, cam); //font spriteName = game.Content.Load<SpriteFont>("menufont"); fontLoc = new Vector2(b.Position.X, b.Position.Y - 10); name = b.UnitName; //Console.WriteLine("Font Location: " + fontLoc.X + ", " + fontLoc.Y); }
private void UpdateSelection(MouseHandler mouseH) { selectionBox.X = (int)position.X - cam.CamPosX; selectionBox.Y = (int)position.Y - cam.CamPosY; selectionBox.Width = image.Width; selectionBox.Height = image.Height + 10; if (mouseH.MouseCurrentState.LeftButton == ButtonState.Pressed && mouseH.MousePreviousState.LeftButton == ButtonState.Released) selection = mouseH.MouseCollision(this.selectionBox, selection); }