|
|
@ -13,6 +13,7 @@ public class Recipe : MonoBehaviour { |
|
|
|
public Frame[] Frames; |
|
|
|
|
|
|
|
public int[] Qtys; |
|
|
|
public int[] heldQtys; |
|
|
|
|
|
|
|
public GameObject RecipeCanvas; |
|
|
|
|
|
|
@ -56,13 +57,34 @@ public class Recipe : MonoBehaviour { |
|
|
|
localPlayer.heldVeggie = null; |
|
|
|
Inventory.gameObject.SetActive(false); |
|
|
|
} |
|
|
|
public void friendlyPickup(string VeggieName, int change) |
|
|
|
{ |
|
|
|
StartCoroutine(ItemLookup(VeggieName, change)); |
|
|
|
} |
|
|
|
|
|
|
|
IEnumerator ItemLookup(string VeggieName, int change) |
|
|
|
{ |
|
|
|
for (int i = 0; i < Veggies.Length; i++) |
|
|
|
{ |
|
|
|
if(Veggies[i].Name == VeggieName) |
|
|
|
{ |
|
|
|
heldQtys[i] += change; |
|
|
|
} |
|
|
|
} |
|
|
|
yield return new WaitForEndOfFrame(); |
|
|
|
} |
|
|
|
|
|
|
|
public void CheckInventory(List<GameObject> Players) |
|
|
|
public bool CheckVictory() |
|
|
|
{ |
|
|
|
foreach(GameObject player in Players) |
|
|
|
bool winning = true; |
|
|
|
for (int i = 0; i < Veggies.Length; i++) |
|
|
|
{ |
|
|
|
Player PS = player.GetComponent<Player>(); |
|
|
|
if (Qtys[i] != heldQtys[i]) |
|
|
|
{ |
|
|
|
winning = false; |
|
|
|
} |
|
|
|
} |
|
|
|
return winning; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|