Made a Gui and created a dropdown menu to select block
This commit is contained in:
@@ -5,7 +5,7 @@ namespace Collector.Character
|
||||
{
|
||||
public class Collision
|
||||
{
|
||||
public RectangleF Rectangle { get; private set; }
|
||||
public RectangleF Rectangle { get; }
|
||||
|
||||
public Collision(int x, int y)
|
||||
{
|
||||
|
||||
@@ -166,10 +166,15 @@ namespace Collector.Character
|
||||
}
|
||||
if (mouseState.RightButton == ButtonState.Pressed)
|
||||
{
|
||||
Chunks.PlaceBlock(PlayerMouse.GetSelectedX(),PlayerMouse.GetSelectedY(),Blocks.BlockWood);
|
||||
PlaceSelectedBlock(Inventory.GetSelectedItem());
|
||||
}
|
||||
}
|
||||
|
||||
private static void PlaceSelectedBlock(Blocks selectedItem)
|
||||
{
|
||||
Chunks.PlaceBlock(PlayerMouse.GetSelectedX(), PlayerMouse.GetSelectedY(), selectedItem);
|
||||
}
|
||||
|
||||
private void UpdateAnimationFrame(GameTime gameTime)
|
||||
{
|
||||
_timeSinceLastFrame += gameTime.GetElapsedSeconds();
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using Collector.Dimension;
|
||||
|
||||
using Collector.UI;
|
||||
using Myra.Graphics2D.UI;
|
||||
|
||||
public class Inventory {
|
||||
private LinkedList<ItemStack> inventory = new LinkedList<ItemStack>();
|
||||
|
||||
public static Blocks GetSelectedItem()
|
||||
{
|
||||
return (Blocks) Gui._combo.SelectedIndex.Value;
|
||||
}
|
||||
|
||||
public LinkedList<ItemStack> GetInventory() {
|
||||
return inventory;
|
||||
|
||||
Reference in New Issue
Block a user