From 014a8604094ef95d2d63f00c92707036b89d6750 Mon Sep 17 00:00:00 2001 From: JR-Morgan <45512892+JR-Morgan@users.noreply.github.com> Date: Fri, 24 Jul 2020 00:56:48 +0100 Subject: [PATCH] Minor bug fixes for showcase - Campfire now takes wood - Campfire stays lit for twice as long - All temperatures have been shifted -20C - Towers now spawn every 3 zones - Colonists start with wood --- .../Interactables/Buildings/CampFire.cs | 17 +++++++++++++---- .../Interactables/InteractablesFactory.cs | 1 + .../UI/Controllers/GameUIController.cs | 2 +- TeamProject/GlobalWarmingGame/ZoneGenerator.cs | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/TeamProject/GlobalWarmingGame/Interactions/Interactables/Buildings/CampFire.cs b/TeamProject/GlobalWarmingGame/Interactions/Interactables/Buildings/CampFire.cs index e615a87..64b4576 100644 --- a/TeamProject/GlobalWarmingGame/Interactions/Interactables/Buildings/CampFire.cs +++ b/TeamProject/GlobalWarmingGame/Interactions/Interactables/Buildings/CampFire.cs @@ -32,7 +32,7 @@ public CampFire() : base(Vector2.Zero, Textures.MapSet[TextureSetTypes.CampFire] [PFSerializable] public float timeUntilBurntout; - private const float burnoutTime = 15000f; + private const float burnoutTime = 30000f; public CampFire(Vector2 position, bool heating = true, float timeUntilBurntout = burnoutTime) : base ( @@ -59,9 +59,18 @@ public CampFire(Vector2 position, bool heating = true, float timeUntilBurntout = private void Fuel(Instruction instruction) { - Heating = true; - TextureGroupIndex = 1; - InstructionTypes.Clear(); + if (instruction.ActiveMember.Inventory.ContainsAll(instruction.Type.RequiredResources)) + { + foreach (ResourceItem item in instruction.Type.RequiredResources) + { + instruction.ActiveMember.Inventory.RemoveItem(item); + } + + Heating = true; + TextureGroupIndex = 1; + InstructionTypes.Clear(); + + } } public override void Update(GameTime gameTime) diff --git a/TeamProject/GlobalWarmingGame/Interactions/Interactables/InteractablesFactory.cs b/TeamProject/GlobalWarmingGame/Interactions/Interactables/InteractablesFactory.cs index 160b8b3..2652268 100644 --- a/TeamProject/GlobalWarmingGame/Interactions/Interactables/InteractablesFactory.cs +++ b/TeamProject/GlobalWarmingGame/Interactions/Interactables/InteractablesFactory.cs @@ -29,6 +29,7 @@ public static IInteractable MakeInteractable(Interactable interactable, Vector2 case Interactable.Colonist: Inventory i = new Inventory(Colonist.COLONIST_DEFAULT_INVENTORY_SIZE); i.AddItem(new ResourceItem(Resource.Food, 10)); + i.AddItem(new ResourceItem(Resource.Wood, 10)); return new Colonist(position, i); case Interactable.Merchant: return new Merchant(position); diff --git a/TeamProject/GlobalWarmingGame/UI/Controllers/GameUIController.cs b/TeamProject/GlobalWarmingGame/UI/Controllers/GameUIController.cs index 158d266..d77280d 100644 --- a/TeamProject/GlobalWarmingGame/UI/Controllers/GameUIController.cs +++ b/TeamProject/GlobalWarmingGame/UI/Controllers/GameUIController.cs @@ -451,7 +451,7 @@ private static void UpdateTemperature(Vector2 gameHover, Vector2 screenHover) if (t != null && !view.Hovering) { - int temperature = MathHelper.Clamp((int)Math.Round(t.Temperature.Value), -50, +50); + int temperature = MathHelper.Clamp((int)Math.Round(t.Temperature.Value), -50, +50) - 30; if (temperature == 0) temp = "±"; else if (temperature > 0) diff --git a/TeamProject/GlobalWarmingGame/ZoneGenerator.cs b/TeamProject/GlobalWarmingGame/ZoneGenerator.cs index af7c50e..2a6ee00 100644 --- a/TeamProject/GlobalWarmingGame/ZoneGenerator.cs +++ b/TeamProject/GlobalWarmingGame/ZoneGenerator.cs @@ -12,7 +12,7 @@ namespace GlobalWarmingGame { static class ZoneGenerator { - private static readonly int towerDistance = 7; + private static readonly int towerDistance = 3; private static readonly int towerSpan = 100; ///