Added requirements to mixer recipes
This commit is contained in:
@@ -6395,7 +6395,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: f9c5dbc6e19942c19f4dc93fc3777677, type: 3}
|
m_Script: {fileID: 11500000, guid: f9c5dbc6e19942c19f4dc93fc3777677, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier: Fruitomation::Fruitomation.UI.BasicUpgradeButton
|
m_EditorClassIdentifier: Fruitomation::Fruitomation.UI.BasicUpgradeButton
|
||||||
Upgrade: 0
|
Upgrade: 35
|
||||||
DrawDefaultLines: 1
|
DrawDefaultLines: 1
|
||||||
Cost:
|
Cost:
|
||||||
Magnitude: 0
|
Magnitude: 0
|
||||||
|
|||||||
@@ -11,11 +11,13 @@ namespace Fruitomation.Game
|
|||||||
{
|
{
|
||||||
private struct Recipe
|
private struct Recipe
|
||||||
{
|
{
|
||||||
|
public BasicUpgrade Requirement;
|
||||||
public ItemType[] Ingredients;
|
public ItemType[] Ingredients;
|
||||||
public ItemType Product;
|
public ItemType Product;
|
||||||
|
|
||||||
public Recipe(ItemType[] ingredients, ItemType product)
|
public Recipe(BasicUpgrade requirement, ItemType[] ingredients, ItemType product)
|
||||||
{
|
{
|
||||||
|
Requirement = requirement;
|
||||||
Ingredients = ingredients;
|
Ingredients = ingredients;
|
||||||
Product = product;
|
Product = product;
|
||||||
}
|
}
|
||||||
@@ -25,6 +27,7 @@ namespace Fruitomation.Game
|
|||||||
{
|
{
|
||||||
new
|
new
|
||||||
(
|
(
|
||||||
|
BasicUpgrade.DriedFruitSelection,
|
||||||
new[]
|
new[]
|
||||||
{
|
{
|
||||||
ItemType.DriedAppleSlices,
|
ItemType.DriedAppleSlices,
|
||||||
@@ -36,6 +39,7 @@ namespace Fruitomation.Game
|
|||||||
|
|
||||||
new
|
new
|
||||||
(
|
(
|
||||||
|
BasicUpgrade.AppleMangoJuice,
|
||||||
new[]
|
new[]
|
||||||
{
|
{
|
||||||
ItemType.AppleJuice,
|
ItemType.AppleJuice,
|
||||||
@@ -46,6 +50,7 @@ namespace Fruitomation.Game
|
|||||||
|
|
||||||
new
|
new
|
||||||
(
|
(
|
||||||
|
BasicUpgrade.SpicedBananaIceCream,
|
||||||
new[]
|
new[]
|
||||||
{
|
{
|
||||||
ItemType.BananaIceCream,
|
ItemType.BananaIceCream,
|
||||||
@@ -56,6 +61,7 @@ namespace Fruitomation.Game
|
|||||||
|
|
||||||
new
|
new
|
||||||
(
|
(
|
||||||
|
BasicUpgrade.ExoticFruitSelection,
|
||||||
new[]
|
new[]
|
||||||
{
|
{
|
||||||
ItemType.SlicedKiwi,
|
ItemType.SlicedKiwi,
|
||||||
@@ -68,6 +74,7 @@ namespace Fruitomation.Game
|
|||||||
|
|
||||||
new
|
new
|
||||||
(
|
(
|
||||||
|
BasicUpgrade.SpicedPitayaIceCream,
|
||||||
new[]
|
new[]
|
||||||
{
|
{
|
||||||
ItemType.PitayaIceCream,
|
ItemType.PitayaIceCream,
|
||||||
@@ -133,6 +140,8 @@ namespace Fruitomation.Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (Recipe recipe in Recipes)
|
foreach (Recipe recipe in Recipes)
|
||||||
|
{
|
||||||
|
if (UpgradeManager.Is(recipe.Requirement))
|
||||||
{
|
{
|
||||||
bool hasAllIngredients = recipe.Ingredients.Aggregate(true,
|
bool hasAllIngredients = recipe.Ingredients.Aggregate(true,
|
||||||
(current, ingredient)
|
(current, ingredient)
|
||||||
@@ -159,4 +168,5 @@ namespace Fruitomation.Game
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
using System.Collections.Generic;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine.Scripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.IO;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
@@ -13,7 +14,6 @@ namespace Fruitomation.Game
|
|||||||
{
|
{
|
||||||
[Serializable] public enum BasicUpgrade
|
[Serializable] public enum BasicUpgrade
|
||||||
{
|
{
|
||||||
//Apple, - Unlocked by default
|
|
||||||
Grapes,
|
Grapes,
|
||||||
Bananas,
|
Bananas,
|
||||||
Kiwi,
|
Kiwi,
|
||||||
@@ -50,6 +50,8 @@ namespace Fruitomation.Game
|
|||||||
PitayaFoodDye,
|
PitayaFoodDye,
|
||||||
PitayaIceCream,
|
PitayaIceCream,
|
||||||
SpicedPitayaIceCream,
|
SpicedPitayaIceCream,
|
||||||
|
|
||||||
|
Apple
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable] public enum BuildingUnlock
|
[Serializable] public enum BuildingUnlock
|
||||||
@@ -57,20 +59,20 @@ namespace Fruitomation.Game
|
|||||||
None,
|
None,
|
||||||
|
|
||||||
//Wall, - Unlocked by default
|
//Wall, - Unlocked by default
|
||||||
//Slope,
|
//Slope, - Unlocked by default
|
||||||
Floor,
|
[Preserve] Floor,
|
||||||
|
|
||||||
//Spring, - Unlocked by default
|
//Spring, - Unlocked by default
|
||||||
Fan,
|
[Preserve] Fan,
|
||||||
Alternator,
|
[Preserve] Alternator,
|
||||||
|
|
||||||
//Slicer, - Unlocked by default
|
//Slicer, - Unlocked by default
|
||||||
//Presser, - Unlocked by default
|
//Presser, - Unlocked by default
|
||||||
HeatExchanger,
|
[Preserve] HeatExchanger,
|
||||||
Grinder,
|
[Preserve] Grinder,
|
||||||
Mixer,
|
[Preserve] Mixer,
|
||||||
Fermenter,
|
[Preserve] Fermenter,
|
||||||
Peeler,
|
[Preserve] Peeler,
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UnlockedUpgrades
|
public class UnlockedUpgrades
|
||||||
@@ -149,6 +151,8 @@ namespace Fruitomation.Game
|
|||||||
{
|
{
|
||||||
CurrentUpgrades = JsonUtility.FromJson<UnlockedUpgrades.Serialized>(json).Unserialize();
|
CurrentUpgrades = JsonUtility.FromJson<UnlockedUpgrades.Serialized>(json).Unserialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CurrentUpgrades.Unlock(BasicUpgrade.Apple); // Unlocked by default
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentUpgrades ??= new UnlockedUpgrades();
|
CurrentUpgrades ??= new UnlockedUpgrades();
|
||||||
@@ -189,6 +193,7 @@ namespace Fruitomation.Game
|
|||||||
public static void ResetUpgrades()
|
public static void ResetUpgrades()
|
||||||
{
|
{
|
||||||
CurrentUpgrades = new UnlockedUpgrades();
|
CurrentUpgrades = new UnlockedUpgrades();
|
||||||
|
CurrentUpgrades.Unlock(BasicUpgrade.Apple); // Always unlocked
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("Fruitomation/Unlock All Upgrades")]
|
[MenuItem("Fruitomation/Unlock All Upgrades")]
|
||||||
|
|||||||
Reference in New Issue
Block a user