Beispiel #1
0
        public void Update()
        {
            MouseItem.Update();

            Inventory.Update();

            if (MouseInput.MouseClickedLeft())
            {
                if (MouseItem.Item != null && GridCraft.AddItem(MouseInput.MouseRealPosMenu(), _items, MouseItem.Item.Rotation) == true)
                {
                    if (Game1.PlayerInstance.Items.Any(i => i.Type == MouseItem.Item.Type) == true)
                    {
                        Game1.PlayerInstance.Items.Single(i => i.Type == MouseItem.Item.Type).Amount--;
                    }

                    if (Game1.PlayerInstance.Items.Single(i => i.Type == MouseItem.Item.Type).Amount <= 0)
                    {
                        Game1.PlayerInstance.Items.Remove(Game1.PlayerInstance.Items.Single(i => i.Type == MouseItem.Item.Type));
                    }

                    MouseItem.Item = null;

                    Inventory.ResetChoosed();
                    CalculateAll();
                }
            }

            if (MouseInput.MouseClickedRight())
            {
                GridItem item = GridCraft.RemoveItem(MouseInput.MouseRealPosMenu(), _items);

                if (item != null)
                {
                    if (Game1.PlayerInstance.Items.Any(i => i.Type == item.Type) == true)
                    {
                        Game1.PlayerInstance.Items.Single(i => i.Type == item.Type).Amount++;
                    }
                    else
                    {
                        Game1.PlayerInstance.Items.Add(new PlayersItem(item.Type, 1));
                    }
                }

                UIShop.Instance.Sync();

                CalculateAll();
            }
            UIShop.Instance.Sync();
            Inventory.Set();
        }
Beispiel #2
0
        public void Draw()
        {
            Inventory.Draw(Game1.MenuParts);
            GridCraft.Draw(_items);
            MouseItem.Draw(GridCraft.Position);

            DrawString.DrawText("Max Ammo: ", new Vector2(XposText, YposText), Align.left, Color.White, FontType.small);
            DrawString.DrawText(Game1.PlayerInstance.Weapons[0].MaxAmmo.ToString(), new Vector2(XposTextBase, YposText), Align.left, Color.White, FontType.small);

            DrawString.DrawText("Timing: ", new Vector2(XposText, YposText + 32), Align.left, Color.White, FontType.small);
            DrawString.DrawText(Game1.PlayerInstance.Weapons[0].GunTimer.DelayMilisec.ToString(), new Vector2(XposTextBase, YposText + 32), Align.left, Color.White, FontType.small);

            DrawString.DrawText("Velocity: ", new Vector2(XposText, YposText + 64), Align.left, Color.White, FontType.small);
            DrawString.DrawText(Game1.PlayerInstance.Weapons[0].VelocityOfProjectile.ToString(), new Vector2(XposTextBase, YposText + 64), Align.left, Color.White, FontType.small);

            if (Game1.PlayerInstance.Weapons[0].DispersionPlus <= 0)
            {
                DrawString.DrawText(((int)(Game1.PlayerInstance.Weapons[0].VelocityOfProjectilePlus * 100)).ToString(), new Vector2(XposTextBonus, YposText + 64), Align.left, Color.ForestGreen, FontType.small);
            }
            else
            {
                DrawString.DrawText(((int)(Game1.PlayerInstance.Weapons[0].VelocityOfProjectilePlus * 100)).ToString(), new Vector2(XposTextBonus, YposText + 64), Align.left, Color.DarkRed, FontType.small);
            }

            DrawString.DrawText("Dispersion: ", new Vector2(XposText, YposText + 96), Align.left, Color.White, FontType.small);
            DrawString.DrawText(((int)(Game1.PlayerInstance.Weapons[0].Dispersion * 100)).ToString(), new Vector2(XposTextBase, YposText + 96), Align.left, Color.White, FontType.small);

            if (Game1.PlayerInstance.Weapons[0].DispersionPlus <= 0)
            {
                DrawString.DrawText(((int)(Game1.PlayerInstance.Weapons[0].DispersionPlus * 100)).ToString(), new Vector2(XposTextBonus, YposText + 96), Align.left, Color.ForestGreen, FontType.small);
            }
            else
            {
                DrawString.DrawText(((int)(Game1.PlayerInstance.Weapons[0].DispersionPlus * 100)).ToString(), new Vector2(XposTextBonus, YposText + 96), Align.left, Color.DarkRed, FontType.small);
            }

            DrawString.DrawText("Damage: ", new Vector2(XposText, YposText + 128), Align.left, Color.White, FontType.small);
            DrawString.DrawText(Game1.PlayerInstance.Weapons[0].Damage.ToString(), new Vector2(XposTextBase, YposText + 128), Align.left, Color.White, FontType.small);

            if (Game1.PlayerInstance.Weapons[0].DamagePlus >= 0)
            {
                DrawString.DrawText(((Game1.PlayerInstance.Weapons[0].DamagePlus)).ToString(), new Vector2(XposTextBonus, YposText + 128), Align.left, Color.ForestGreen, FontType.small);
            }
            else
            {
                DrawString.DrawText(((Game1.PlayerInstance.Weapons[0].DamagePlus)).ToString(), new Vector2(XposTextBonus, YposText + 128), Align.left, Color.DarkRed, FontType.small);
            }
        }