summaryrefslogtreecommitdiff
path: root/Penguloon
diff options
context:
space:
mode:
authoraldrikboy <aldrikboy@gmail.com>2018-01-14 15:46:58 +0100
committeraldrikboy <aldrikboy@gmail.com>2018-01-14 15:46:58 +0100
commita0217e8ffaceb6bc109eec270c754935a54eb404 (patch)
tree612a5c6b54148b45a05eb74ea40af541ec69cbb2 /Penguloon
parent8d30b5ac461e95cabfc74e46b610beabd81cb460 (diff)
upgrades
Diffstat (limited to 'Penguloon')
-rw-r--r--Penguloon/Content/Content.mgcb48
-rw-r--r--Penguloon/Content/UI/explosion.pngbin0 -> 6446 bytes
-rw-r--r--Penguloon/Content/UI/heart.pngbin0 -> 3499 bytes
-rw-r--r--Penguloon/Content/UI/money.pngbin0 -> 6357 bytes
-rw-r--r--Penguloon/Content/UI/speed.pngbin0 -> 10379 bytes
-rw-r--r--Penguloon/ContentPathManager.cs5
-rw-r--r--Penguloon/Objects/ObjectBase.cs8
-rw-r--r--Penguloon/Objects/ObjectUpgrade.cs91
-rw-r--r--Penguloon/Objects/PenguinObject.cs6
-rw-r--r--Penguloon/Penguloon.csproj1
-rw-r--r--Penguloon/Scenes/GameScene.cs28
-rw-r--r--Penguloon/StaticUIValues.cs4
12 files changed, 191 insertions, 0 deletions
diff --git a/Penguloon/Content/Content.mgcb b/Penguloon/Content/Content.mgcb
index 3edc440..4ccf085 100644
--- a/Penguloon/Content/Content.mgcb
+++ b/Penguloon/Content/Content.mgcb
@@ -841,3 +841,51 @@
/processorParam:TextureFormat=Color
/build:UI/BtnResetPressed.png
+#begin UI/heart.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:UI/heart.png
+
+#begin UI/explosion.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:UI/explosion.png
+
+#begin UI/speed.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:UI/speed.png
+
+#begin UI/money.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:UI/money.png
+
diff --git a/Penguloon/Content/UI/explosion.png b/Penguloon/Content/UI/explosion.png
new file mode 100644
index 0000000..e0a2273
--- /dev/null
+++ b/Penguloon/Content/UI/explosion.png
Binary files differ
diff --git a/Penguloon/Content/UI/heart.png b/Penguloon/Content/UI/heart.png
new file mode 100644
index 0000000..3edb530
--- /dev/null
+++ b/Penguloon/Content/UI/heart.png
Binary files differ
diff --git a/Penguloon/Content/UI/money.png b/Penguloon/Content/UI/money.png
new file mode 100644
index 0000000..88f411d
--- /dev/null
+++ b/Penguloon/Content/UI/money.png
Binary files differ
diff --git a/Penguloon/Content/UI/speed.png b/Penguloon/Content/UI/speed.png
new file mode 100644
index 0000000..73dc939
--- /dev/null
+++ b/Penguloon/Content/UI/speed.png
Binary files differ
diff --git a/Penguloon/ContentPathManager.cs b/Penguloon/ContentPathManager.cs
index afbf735..0d1ed6d 100644
--- a/Penguloon/ContentPathManager.cs
+++ b/Penguloon/ContentPathManager.cs
@@ -63,6 +63,11 @@ namespace Penguloon
"UI/BtnResetPressed",
"UI/BtnResetIdle",
+ "UI/speed",
+ "UI/money",
+ "UI/heart",
+ "UI/explosion",
+
"SplashArt/locked",
"SplashArt/1",
"SplashArt/2",
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)
{
diff --git a/Penguloon/Penguloon.csproj b/Penguloon/Penguloon.csproj
index 71b4060..2181059 100644
--- a/Penguloon/Penguloon.csproj
+++ b/Penguloon/Penguloon.csproj
@@ -93,6 +93,7 @@
<Compile Include="Objects\GoldPenguinObject.cs" />
<Compile Include="Objects\HealthGeneratorObject.cs" />
<Compile Include="Objects\ObjectBase.cs" />
+ <Compile Include="Objects\ObjectUpgrade.cs" />
<Compile Include="Objects\PenguinObject.cs" />
<Compile Include="Projectiles\CannonballProjectile.cs" />
<Compile Include="Projectiles\ProjectileBase.cs" />
diff --git a/Penguloon/Scenes/GameScene.cs b/Penguloon/Scenes/GameScene.cs
index 06c171c..20bf7c4 100644
--- a/Penguloon/Scenes/GameScene.cs
+++ b/Penguloon/Scenes/GameScene.cs
@@ -128,10 +128,38 @@ namespace Penguloon.Scenes
destinationRectangle: new Rectangle(Level.Map.MapWidth + StaticUIValues.BorderWidth,
0, (int)StaticUIValues.ScreenViewport.X - (Level.Map.MapWidth + StaticUIValues.BorderWidth), (int)StaticUIValues.ScreenViewport.Y));
+ if (Level.SelectedObject != null)
+ {
+ for (int i = 0; i < Level.SelectedObject.UpgradeList.Count; i++)
+ {
+ Level.SelectedObject.UpgradeList[i].Draw(Main.SpriteBatch, i);
+ }
+ }
+
//border
Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/border"),
destinationRectangle: new Rectangle(Level.Map.MapWidth,
0, StaticUIValues.BorderWidth, (int)StaticUIValues.ScreenViewport.Y));
+
+ //border under text
+ Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/border-horizontal"),
+ destinationRectangle: new Rectangle(Level.Map.MapWidth + StaticUIValues.BorderWidth - 4,
+ StaticUIValues.IngameUITextAreaHeight, (int)StaticUIValues.ScreenViewport.X - (Level.Map.MapWidth + StaticUIValues.BorderWidth - 5), StaticUIValues.BorderWidth));
+
+ DrawText(ContentManager.GetFont(StaticUIValues.IngameFont), Main.Resources.GetString(Resource.String.IngameGold) + ": " + Level.Money,
+ new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth + 5, 10),
+ new Vector2(StaticUIValues.ScreenViewport.X - Level.Map.MapWidth - StaticUIValues.BorderWidth, StaticUIValues.IngameUITextAreaHeight),
+ TextAllignment.LeftTop, Color.White, Color.Black, 2);
+
+ DrawText(ContentManager.GetFont(StaticUIValues.IngameFont), Main.Resources.GetString(Resource.String.IngameWave) + ": " + Level.Map.WaveManager.CurrentWave.ToString(),
+ new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth + 5, 0),
+ new Vector2(StaticUIValues.ScreenViewport.X - Level.Map.MapWidth - StaticUIValues.BorderWidth, StaticUIValues.IngameUITextAreaHeight),
+ TextAllignment.LeftMiddle, Color.White, Color.Black, 2);
+
+ DrawText(ContentManager.GetFont(StaticUIValues.IngameFont), Main.Resources.GetString(Resource.String.IngameHealth) + ": " + Level.Health,
+ new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth + 5, 0),
+ new Vector2(StaticUIValues.ScreenViewport.X - Level.Map.MapWidth - StaticUIValues.BorderWidth, StaticUIValues.IngameUITextAreaHeight),
+ TextAllignment.LeftBottom, Color.White, Color.Black, 2);
}
private void DrawUI(float deltaTime)
diff --git a/Penguloon/StaticUIValues.cs b/Penguloon/StaticUIValues.cs
index b3238bd..230b29c 100644
--- a/Penguloon/StaticUIValues.cs
+++ b/Penguloon/StaticUIValues.cs
@@ -43,6 +43,8 @@ namespace Penguloon
public static Vector2 AlertSize { get; set; }
+ public static Vector2 UpgradePanelSize { get; set; }
+
public static void Initialize(Main main)
{
ScreenViewport = main.GraphicsDevice.Viewport.Bounds.Size.ToVector2();
@@ -124,6 +126,8 @@ namespace Penguloon
AlertSize = new Vector2((int)(800 * 0.8), (int)(200 * 0.8));
}
+ UpgradePanelSize = new Vector2(IngameUIWidth, 100);
+
LoadingProgressbarPosition = new Vector2((ScreenViewport.X - LoadingProgressbarSize.X) / 2, ScreenViewport.Y - LoadingProgressbarSize.Y - 200);
LoadingProgressbarValuePosition = new Vector2(LoadingProgressbarPosition.X + 5, LoadingProgressbarPosition.Y + 5);