Ejemplo n.º 1
0
    //have this called from apiaryOrganiser
    public int startBreeding(GameObject beeOne, GameObject beeTwo)
    {
        //get the types of the bees from the slots
        //then based on the rules breed them
        string beeO = beeOne.GetComponentInChildren <Bee>().type;
        string beeT = beeTwo.GetComponentInChildren <Bee>().type;

        string        key  = beeO + "_" + beeT;
        List <string> keys = new List <string>(beeRecipes.Keys);
        //it stopped initialising here due to the duplicate key: FIXED
        Recipe temp;

        if (beeRecipes.TryGetValue(key, out temp))
        {
            temp              = beeRecipes[key];
            beeResults        = breed(temp);
            honeyNumberResult = honeyResult(temp);

            //have to put condition in here: IF it is a valid recipe then check for game ending event, then check for null magic mantle
            if (key == "diligentWorker_exoticWorker" || key == "exoticWorker_diligentWorker")
            {
                ScenarioManager.CreateEndGameEvent();
            }
            else if (illegalBees.Contains(beeO) || illegalBees.Contains(beeT))            //one or both of these is an illegal bee
            {
                if (!backpack.itemTruth["cloak"])
                {
                    ScenarioManager.CreateDisasterousEvent();
                }
            }

            return(temp.turns);
        }
        else
        {
            return(-100);
        }
    }