/// <summary> /// Player constructor. /// </summary> /// <param name="g"></param> /// <param name="cm"></param> /// <param name="c"></param> public Player(Game1 g, Color c) { this.g = g; this.c = c; selectionTex = Game1.GetInstance().Content.Load<Texture2D>("Selection"); selectedTex = Game1.GetInstance().Content.Load<Texture2D>("Selected"); Unit u = new Engineer(this, new Vector2(g.screenWidth / 2, g.screenHeight / 2), 1f, 0f, c); units.AddLast(u); buildings = new LinkedList<Building>(); hud = new HUD(this, c); }
/// <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; }