public void AddStuff(DataBase DBase, GameLoop loop) { level = new Level(DBase, inventory); inventory.level = level; level.UpdatePlayerInfo(this); this.loop = loop; }
public void Draw(GameLoop gl) { gl.window.Draw(rectangle); if (text != null) { gl.window.Draw(text); } }
public static void Message(GameLoop gameLoop, object message, float y) { if (consoleFont == null) { return; } Text text = CreateText(message, y); gameLoop.window.Draw(text); }
public static void Message(GameLoop gameLoop, object message) { if (consoleFont == null) { return; } fontColor = Color.Black; Text text = CreateText(message, 0); gameLoop.window.Draw(text); }
public static void Message(GameLoop gameLoop, object message, Color color) { if (consoleFont == null) { return; } Text text = CreateText(message, 0); fontColor = color; gameLoop.window.Draw(text); }
public void Draw(GameLoop gameLoop) { if (player.currentState == Player.state.walk) { legs.Draw(gameLoop); body.Draw(gameLoop); sword.Draw(gameLoop); head.Draw(gameLoop); } else if (player.currentState == Player.state.fight) { btnAttack.Draw(gameLoop); btnDefend.Draw(gameLoop); btnItem.Draw(gameLoop); } }
private void UsePlayerIcons(GameLoop loop) { if (head.IsButtonHold(loop, Mouse.Button.Right) && player.inventory.head != null) { player.inventory.TakeOff(Defence.type.head); } if (legs.IsButtonHold(loop, Mouse.Button.Right) && player.inventory.legs != null) { player.inventory.TakeOff(Defence.type.legs); } if (body.IsButtonHold(loop, Mouse.Button.Right) && player.inventory.body != null) { player.inventory.TakeOff(Defence.type.body); } if (sword.IsButtonHold(loop, Mouse.Button.Right) && player.inventory.weapon != null) { player.inventory.TakeOffWeapon(); } UpdateIcons(); }
public void UseInventory(GameLoop loop) { foreach (InventoryButton btn in items) { if (btn.IsButtonHold(loop)) { int i = items.IndexOf(btn); if (btn.obj != null) { player.inventory.TakeOn(btn.obj); } else if (btn.objWeapon != null) { player.inventory.TakeOn(btn.objWeapon); } items.Remove(btn); break; } } UpdatePlayerInventory(); UsePlayerIcons(loop); UpdateIcons(); }
public bool IsButtonHold(GameLoop loop, Mouse.Button btn) => rectangle.GetGlobalBounds().Contains(Mouse.GetPosition(loop.window).X, Mouse.GetPosition(loop.window).Y) && Mouse.IsButtonPressed(btn);