Beispiel #1
0
        /// <summary>
        /// Engineer Constructor.
        /// </summary>
        /// <param name="p"></param>
        /// <param name="cm"></param>
        /// <param name="startLocation"></param>
        /// <param name="c"></param>
        public Engineer(Player p, Vector2 startLocation, float movementSpeed, float direction, Color c)
        {
            this.p = p;
            this.movementSpeed = movementSpeed;
            this.direction = direction;
            this.c = c;
            this.type = UnitType.Engineer;

            this.texture = Game1.GetInstance().Content.Load<Texture2D>("Units/Engineer");

            Vector2 newLocation = new Vector2((startLocation.X - (this.texture.Width / 2)), (startLocation.Y - (this.texture.Height / 2)));
            this.location = newLocation;

            MouseManager.GetInstance().mouseClickedListeners += ((MouseClickListener)this).OnMouseClick;
            MouseManager.GetInstance().mouseReleasedListeners += ((MouseClickListener)this).OnMouseRelease;
        }
Beispiel #2
0
        /// <summary>
        /// HUD Constructor.
        /// </summary>
        /// <param name="p"></param>
        /// <param name="cm"></param>
        /// <param name="c"></param>
        public HUD(Player p, Color c)
        {
            this.p = p;
            this.c = c;

            hudTex = Game1.GetInstance().Content.Load<Texture2D>("HUD/HUD");
            hudResourcesTex = Game1.GetInstance().Content.Load<Texture2D>("HUD/HUDResources");
            hudBarracksTex = Game1.GetInstance().Content.Load<Texture2D>("HUD/HUDBarracks");
            hudFactoryTex = Game1.GetInstance().Content.Load<Texture2D>("HUD/HUDFactory");
            hudFortressTex = Game1.GetInstance().Content.Load<Texture2D>("HUD/HUDFortress");

            hudItemDetails = Game1.GetInstance().Content.Load<Texture2D>("HUD/HUDItemDetails");

            sf = Game1.GetInstance().Content.Load<SpriteFont>("Fonts/SpriteFont1");

            draw = false;

            MouseManager.GetInstance().mouseClickedListeners += ((MouseClickListener)this).OnMouseClick;
            MouseManager.GetInstance().mouseReleasedListeners += ((MouseClickListener)this).OnMouseRelease;

            instance = this;
        }
Beispiel #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            device = graphics.GraphicsDevice;

            Player player1 = new Player(this, Color.Red);
            players.AddLast(player1);
        }