summaryrefslogtreecommitdiff
path: root/Penguloon/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Penguloon/Objects')
-rw-r--r--Penguloon/Objects/ObjectBase.cs8
-rw-r--r--Penguloon/Objects/ObjectUpgrade.cs91
-rw-r--r--Penguloon/Objects/PenguinObject.cs6
3 files changed, 105 insertions, 0 deletions
diff --git a/Penguloon/Objects/ObjectBase.cs b/Penguloon/Objects/ObjectBase.cs
index aef4e6a..e5d9fe5 100644
--- a/Penguloon/Objects/ObjectBase.cs
+++ b/Penguloon/Objects/ObjectBase.cs
@@ -37,10 +37,14 @@ namespace Penguloon.Objects
public bool Selected { get; set; } = false;
+ public List<ObjectUpgrade> UpgradeList { get; set; } = new List<ObjectUpgrade>();
+
public ObjectBase(Vector2 position, Map map)
{
this.Map = map;
this.Position = position;
+
+ CreateUpgrades();
}
public ObjectBase(Map map)
@@ -48,6 +52,10 @@ namespace Penguloon.Objects
this.Map = map;
}
+ public virtual void CreateUpgrades()
+ {
+ }
+
public bool RoundFinished { get; set; } = true;
public void Update(float deltaTime)
diff --git a/Penguloon/Objects/ObjectUpgrade.cs b/Penguloon/Objects/ObjectUpgrade.cs
new file mode 100644
index 0000000..c1f701a
--- /dev/null
+++ b/Penguloon/Objects/ObjectUpgrade.cs
@@ -0,0 +1,91 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using Android.App;
+using Android.Content;
+using Android.OS;
+using Android.Runtime;
+using Android.Views;
+using Android.Widget;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework;
+
+namespace Penguloon.Objects
+{
+ public enum UpgradeType
+ {
+ Health,
+ PopCount,
+ Speed,
+ Money,
+ }
+
+ public class ObjectUpgrade
+ {
+ public int Cost { get; set; }
+ public ObjectUpgrade NextUgrade { get; set; }
+ public event EventHandler OnClick;
+ public UpgradeType Type { get; set; }
+ public string Text { get; set; }
+
+ private Texture2D Background { get; set; }
+ private Texture2D Icon { get; set; }
+
+ public ObjectUpgrade(int Cost, UpgradeType Type, string Text, ObjectUpgrade NextUgrade)
+ {
+ this.Cost = Cost;
+ this.Type = Type;
+ this.Text = Text;
+ this.NextUgrade = NextUgrade;
+
+ Background = ContentManager.GetTexture("UI/lightred");
+
+ switch (Type)
+ {
+ case UpgradeType.Health: Icon = ContentManager.GetTexture("UI/heart"); break;
+ case UpgradeType.Money: Icon = ContentManager.GetTexture("UI/money"); break;
+ case UpgradeType.PopCount: Icon = ContentManager.GetTexture("UI/explosion"); break;
+ case UpgradeType.Speed: Icon = ContentManager.GetTexture("UI/speed"); break;
+ }
+ }
+
+ public void Click()
+ {
+ OnClick?.Invoke(this, EventArgs.Empty);
+ }
+
+ internal void Draw(SpriteBatch spriteBatch, int index)
+ {
+ int startY = StaticUIValues.IngameUITextAreaHeight + StaticUIValues.BorderWidth;
+
+ SpriteFont font = ContentManager.GetFont(StaticUIValues.IngameFont);
+ int textHeight = (int)font.MeasureString(Text).Y;
+
+ spriteBatch.Draw(Background, destinationRectangle: new Rectangle(
+ (int)StaticUIValues.ScreenViewport.X - StaticUIValues.IngameUIWidth,
+ startY + (int)StaticUIValues.UpgradePanelSize.Y * index,
+ (int)StaticUIValues.UpgradePanelSize.X,
+ (int)StaticUIValues.UpgradePanelSize.Y));
+
+ spriteBatch.Draw(Icon, destinationRectangle: new Rectangle(
+ (int)StaticUIValues.ScreenViewport.X - StaticUIValues.IngameUIWidth + 20,
+ startY + ((int)StaticUIValues.UpgradePanelSize.Y * index) + (int)(StaticUIValues.UpgradePanelSize.Y / 4),
+ (int)StaticUIValues.UpgradePanelSize.Y / 2,
+ (int)StaticUIValues.UpgradePanelSize.Y / 2));
+
+ spriteBatch.DrawString(ContentManager.GetFont(StaticUIValues.IngameFont),
+ Text, new Vector2((int)StaticUIValues.ScreenViewport.X - StaticUIValues.IngameUIWidth + 90,
+ startY + ((int)StaticUIValues.UpgradePanelSize.Y * index) + (int)(StaticUIValues.UpgradePanelSize.Y / 2) - textHeight / 2),
+ Color.FromNonPremultiplied(20, 20, 20, 255));
+
+ spriteBatch.Draw(ContentManager.GetTexture("UI/objectSelectionBorder"),
+ destinationRectangle: new Rectangle(
+ (int)StaticUIValues.ScreenViewport.X - StaticUIValues.IngameUIWidth,
+ startY + (int)StaticUIValues.UpgradePanelSize.Y * index + (int)StaticUIValues.UpgradePanelSize.Y - 2,
+ (int)StaticUIValues.UpgradePanelSize.X,
+ 2));
+ }
+ }
+} \ No newline at end of file
diff --git a/Penguloon/Objects/PenguinObject.cs b/Penguloon/Objects/PenguinObject.cs
index a4fa389..0fc1078 100644
--- a/Penguloon/Objects/PenguinObject.cs
+++ b/Penguloon/Objects/PenguinObject.cs
@@ -27,6 +27,12 @@ namespace Penguloon.Objects
this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectPenguin);
}
+ public override void CreateUpgrades()
+ {
+ UpgradeList.Add(new ObjectUpgrade(100, UpgradeType.PopCount, "+1 pop", null));
+ UpgradeList.Add(new ObjectUpgrade(100, UpgradeType.Speed, "+15 Speed", null));
+ }
+
public override void DrawUnique(float deltaTime)
{