public ActionScreen(Game game, SpriteBatch spriteBatch, Viewport vp)
     : base(game, spriteBatch)
 {
     tMap = new Terrain(game);
     cam = new Camera2D(vp);
     unit = new Building(spriteBatch, game, cam, mouse);
 }
        public StatusBar(Vector2 pos, Texture2D img, int len, Rectangle size, string Direction, SpriteBatch spriteBatch, Camera2D cam)
        {
            this.position = pos;
            this.image = img;
            this.length = len;
            this.size = size;
            this.spriteBatch = spriteBatch;
            this.cam = cam;

            length = (int)(length / 10);
            pImgA = new PosImg[length];

            for (int i = 0; i < length; i++)
            {
                pImg = new PosImg(position, image);
                pImgA[i] = pImg;

                if (Direction == "Right")
                {
                    position.X += size.Width + 1;
                }
                else if (Direction == "Left")
                {
                    position.X -= size.Width - 1;
                }
                else if (Direction == "Up")
                {
                    position.Y -= size.Height - 1;
                }
                else if (Direction == "Down")
                {
                    position.Y += size.Height + 1;
                }
            }
        }
        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!";
 }
        public BuildandUpgrade(SpriteBatch spriteBatch, Camera2D cam, Texture2D image, Vector2 pos)
        {
            this.spriteBatch = spriteBatch;
            this.cam = cam;
            this.image = image;

            size.Width = 30;
            size.Height = 30;
            this.position = pos;
            size.X = (int)position.X;
            size.Y = (int)position.Y;
        }
 public void DrawTerrain(SpriteBatch spriteBatch, Camera2D cam)
 {
     for (int y = 0; y < newTerrain.GetLength(0); y++)
     {
         for (int x = 0; x < newTerrain.GetLength(1); x++)
         {
             spriteBatch.Draw(tiles[newTerrain[y, x]], new Rectangle(x * tileWidth - cam.CamPosX,
                 y * tileHeight - cam.CamPosY, tileWidth, tileHeight),
                 Color.White);
         }
     }
 }
 public BandUList(Game game, SpriteBatch sB, Camera2D cam, Texture2D image, Vector2 pos, Building.BuildingList bL)
 {
     this.spriteBatch = sB;
     this.cam = cam;
     structPos = pos;
     bPos = structPos;
     structImg = image;
     bList = bL;
     UpgradeImage = game.Content.Load<Texture2D>("Upgrade");
     BuildImage = game.Content.Load<Texture2D>("Build");
     initialBuild = new BuildandUpgrade(sB, cam, BuildImage, pos);
     initialUpgrade = new BuildandUpgrade(sB, cam, UpgradeImage, pos);
 }
Beispiel #8
0
        //****************************************
        // 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;
        }
Beispiel #10
0
        //****************************************
        // 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);
        }