예제 #1
0
    bool PotionCreation(GameObject brewPot)
    {
        BrewingPot BP = brewPot.GetComponent <BrewingPot>();

        if (BP.inPot.Count != 2 || BP.currentBrewTime < BP.timeToBrew)
        {
            return(false);
        }

        foreach (List <string> Recipe in RecipeList)
        {
            if ((Recipe[0] == BP.inPot[0] && Recipe[1] == BP.inPot[1]) || (Recipe[1] == BP.inPot[0] && Recipe[0] == BP.inPot[1]) || BP.inPot.Count == 3)
            {
                if (BP.inPot.Count == 3)
                {
                    PotionSpawn(GS.WhitePotion);
                    BP.currentItemCount = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    return(true);
                }
                else if (Recipe == RecipeList[0])
                {
                    BP.currentItemCount = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    if (!GS.OrderMenu)
                    {
                        return(true);
                    }
                    for (int i = 0; i < GS.OrderListNames.Count; i++)
                    {
                        if (GS.OrderListNames[i] == "Red")
                        {
                            GameObject Slot = GS.OrderMenu.transform.Find("Slot" + (i + 1).ToString()).gameObject;
                            //GS.RemoveOrder(i);
                            PotionSpawn(GS.RedPotion);
                            break;
                        }
                        else
                        {
                            InvalidPotionSpawn();
                        }
                    }
                    return(true);
                }
                else if (Recipe == RecipeList[1])
                {
                    BP.currentItemCount = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    if (!GS.OrderMenu)
                    {
                        return(true);
                    }
                    for (int i = 0; i < GS.OrderListNames.Count; i++)
                    {
                        if (GS.OrderListNames[i] == "Blue")
                        {
                            GameObject Slot = GS.OrderMenu.transform.Find("Slot" + (i + 1).ToString()).gameObject;
                            //GS.RemoveOrder(i);
                            PotionSpawn(GS.BluePotion);
                            break;
                        }
                        else
                        {
                            InvalidPotionSpawn();
                        }
                    }
                    return(true);
                }
                else if (Recipe == RecipeList[2])
                {
                    BP.currentItemCount = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    if (!GS.OrderMenu)
                    {
                        return(true);
                    }
                    for (int i = 0; i < GS.OrderListNames.Count; i++)
                    {
                        if (GS.OrderListNames[i] == "Green")
                        {
                            GameObject Slot = GS.OrderMenu.transform.Find("Slot" + (i + 1).ToString()).gameObject;
                            //GS.RemoveOrder(i);
                            PotionSpawn(GS.GreenPotion);
                            break;
                        }
                        else
                        {
                            InvalidPotionSpawn();
                        }
                    }
                    return(true);
                }
                else if (Recipe == RecipeList[3])
                {
                    BP.currentItemCount = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    if (!GS.OrderMenu)
                    {
                        return(true);
                    }
                    for (int i = 0; i < GS.OrderListNames.Count; i++)
                    {
                        if (GS.OrderListNames[i] == "Purple")
                        {
                            GameObject Slot = GS.OrderMenu.transform.Find("Slot" + (i + 1).ToString()).gameObject;
                            //GS.RemoveOrder(i);
                            PotionSpawn(GS.PurplePotion);
                            break;
                        }
                        else
                        {
                            InvalidPotionSpawn();
                        }
                    }
                    return(true);
                }
                else if (Recipe == RecipeList[4])
                {
                    BP.currentItemCount = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    if (!GS.OrderMenu)
                    {
                        return(true);
                    }
                    for (int i = 0; i < GS.OrderListNames.Count; i++)
                    {
                        if (GS.OrderListNames[i] == "Cyan")
                        {
                            GameObject Slot = GS.OrderMenu.transform.Find("Slot" + (i + 1).ToString()).gameObject;
                            //GS.RemoveOrder(i);
                            PotionSpawn(GS.CyanPotion);
                            break;
                        }
                        else
                        {
                            InvalidPotionSpawn();
                        }
                    }
                    return(true);
                }
                else if (Recipe == RecipeList[5])
                {
                    BP.currentItemCount = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    if (!GS.OrderMenu)
                    {
                        return(true);
                    }
                    for (int i = 0; i < GS.OrderListNames.Count; i++)
                    {
                        if (GS.OrderListNames[i] == "Yellow")
                        {
                            GameObject Slot = GS.OrderMenu.transform.Find("Slot" + (i + 1).ToString()).gameObject;
                            //GS.RemoveOrder(i);
                            PotionSpawn(GS.YellowPotion);
                            break;
                        }
                        else
                        {
                            InvalidPotionSpawn();
                        }
                    }
                    return(true);
                }
                else
                {
                    PotionSpawn(GS.WhitePotion);
                    BP.currentItemCount = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    return(true);
                }
            }
        }
        return(false);
    }
예제 #2
0
    bool PotionCreation(GameObject brewPot)
    {
        BrewingPot BP = brewPot.GetComponent <BrewingPot>();

        if (BP.inPot.Count != 2 || BP.currentBrewTime < timeToBrew)
        {
            return(false);
        }

        foreach (List <string> Recipe in RecipeList)
        {
            if ((Recipe[0] == BP.inPot[0] && Recipe[1] == BP.inPot[1]) || (Recipe[1] == BP.inPot[0] && Recipe[0] == BP.inPot[1]) || BP.inPot.Count == 3)
            {
                if (BP.inPot.Count == 3)
                {
                    GS.AwardPoints(gameObject.GetComponent <PlayerMovement>().playerNumber, 100);
                    GameObject Potion = GS.SpawnItem(GS.WhitePotion);
                    Potion.transform.position = transform.position;
                    BP.currentItemCount       = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    return(true);
                }
                else if (Recipe == RecipeList[0])
                {
                    GS.AwardPoints(gameObject.GetComponent <PlayerMovement>().playerNumber, 100);
                    GameObject Potion = GS.SpawnItem(GS.RedPotion);
                    Potion.transform.position = transform.position;
                    BP.currentItemCount       = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    if (!GS.OrderMenu)
                    {
                        return(true);
                    }
                    for (int i = 0; i < GS.OrderListNames.Count; i++)
                    {
                        if (GS.OrderListNames[i] == "Red")
                        {
                            GameObject Slot = GS.OrderMenu.transform.Find("Slot" + (i + 1).ToString()).gameObject;
                            GS.AwardPoints(gameObject.GetComponent <PlayerMovement>().playerNumber, Mathf.RoundToInt(200 * (1f - Slot.GetComponent <Order>().CurrentOverExpire())));
                            GS.RemoveOrder(i);
                            break;
                        }
                    }
                    return(true);
                }
                else if (Recipe == RecipeList[1])
                {
                    GS.AwardPoints(gameObject.GetComponent <PlayerMovement>().playerNumber, 100);
                    GameObject Potion = GS.SpawnItem(GS.BluePotion);
                    Potion.transform.position = transform.position;
                    BP.currentItemCount       = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    if (!GS.OrderMenu)
                    {
                        return(true);
                    }
                    for (int i = 0; i < GS.OrderListNames.Count; i++)
                    {
                        if (GS.OrderListNames[i] == "Blue")
                        {
                            GameObject Slot = GS.OrderMenu.transform.Find("Slot" + (i + 1).ToString()).gameObject;
                            GS.AwardPoints(gameObject.GetComponent <PlayerMovement>().playerNumber, Mathf.RoundToInt(200 * (1f - Slot.GetComponent <Order>().CurrentOverExpire())));
                            GS.RemoveOrder(i);
                            break;
                        }
                    }
                    return(true);
                }
                else if (Recipe == RecipeList[2])
                {
                    GS.AwardPoints(gameObject.GetComponent <PlayerMovement>().playerNumber, 100);
                    GameObject Potion = GS.SpawnItem(GS.GreenPotion);
                    Potion.transform.position = transform.position;
                    BP.currentItemCount       = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    if (!GS.OrderMenu)
                    {
                        return(true);
                    }
                    for (int i = 0; i < GS.OrderListNames.Count; i++)
                    {
                        if (GS.OrderListNames[i] == "Green")
                        {
                            GameObject Slot = GS.OrderMenu.transform.Find("Slot" + (i + 1).ToString()).gameObject;
                            GS.AwardPoints(gameObject.GetComponent <PlayerMovement>().playerNumber, Mathf.RoundToInt(200 * (1f - Slot.GetComponent <Order>().CurrentOverExpire())));
                            GS.RemoveOrder(i);
                            break;
                        }
                    }
                    return(true);
                }
                else if (Recipe == RecipeList[3])
                {
                    GS.AwardPoints(gameObject.GetComponent <PlayerMovement>().playerNumber, 100);
                    GameObject Potion = GS.SpawnItem(GS.PurplePotion);
                    Potion.transform.position = transform.position;
                    BP.currentItemCount       = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    if (!GS.OrderMenu)
                    {
                        return(true);
                    }
                    for (int i = 0; i < GS.OrderListNames.Count; i++)
                    {
                        if (GS.OrderListNames[i] == "Purple")
                        {
                            GameObject Slot = GS.OrderMenu.transform.Find("Slot" + (i + 1).ToString()).gameObject;
                            GS.AwardPoints(gameObject.GetComponent <PlayerMovement>().playerNumber, Mathf.RoundToInt(200 * (1f - Slot.GetComponent <Order>().CurrentOverExpire())));
                            GS.RemoveOrder(i);
                            break;
                        }
                    }
                    return(true);
                }
                else if (Recipe == RecipeList[4])
                {
                    GS.AwardPoints(gameObject.GetComponent <PlayerMovement>().playerNumber, 100);
                    GameObject Potion = GS.SpawnItem(GS.CyanPotion);
                    Potion.transform.position = transform.position;
                    BP.currentItemCount       = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    if (!GS.OrderMenu)
                    {
                        return(true);
                    }
                    for (int i = 0; i < GS.OrderListNames.Count; i++)
                    {
                        if (GS.OrderListNames[i] == "Cyan")
                        {
                            GameObject Slot = GS.OrderMenu.transform.Find("Slot" + (i + 1).ToString()).gameObject;
                            GS.AwardPoints(gameObject.GetComponent <PlayerMovement>().playerNumber, Mathf.RoundToInt(200 * (1f - Slot.GetComponent <Order>().CurrentOverExpire())));
                            GS.RemoveOrder(i);
                            break;
                        }
                    }
                    return(true);
                }
                else if (Recipe == RecipeList[5])
                {
                    GS.AwardPoints(gameObject.GetComponent <PlayerMovement>().playerNumber, 100);
                    GameObject Potion = GS.SpawnItem(GS.YellowPotion);
                    Potion.transform.position = transform.position;
                    BP.currentItemCount       = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    if (!GS.OrderMenu)
                    {
                        return(true);
                    }
                    for (int i = 0; i < GS.OrderListNames.Count; i++)
                    {
                        if (GS.OrderListNames[i] == "Yellow")
                        {
                            GameObject Slot = GS.OrderMenu.transform.Find("Slot" + (i + 1).ToString()).gameObject;
                            GS.AwardPoints(gameObject.GetComponent <PlayerMovement>().playerNumber, Mathf.RoundToInt(200 * (1f - Slot.GetComponent <Order>().CurrentOverExpire())));
                            GS.RemoveOrder(i);
                            break;
                        }
                    }
                    return(true);
                }
                else
                {
                    GS.AwardPoints(gameObject.GetComponent <PlayerMovement>().playerNumber, 100);
                    GameObject Potion = GS.SpawnItem(GS.WhitePotion);
                    Potion.transform.position = transform.position;
                    BP.currentItemCount       = 0;
                    BP.inPot.Clear();
                    BP.ResetGrowClock();
                    return(true);
                }
            }
        }
        return(false);
    }