コード例 #1
0
    public string getPotion(int potionId, bool leftShelf, StatusScript target) //gets potion from recipie
    {
        Vector3 vec = new Vector3(0, 0, 0);                                    //-15,10,0 left 15,10,0 right
        int     location;

        if (leftShelf)
        {
            location = -1;//left=-1 right=1
        }
        else
        {
            location = 1;
        }

        switch (potionId) //case ingredient1 * ingredient2 * ingredient3... etc.
        {
        case (int)Ingredients.batwing * (int)Ingredients.chamomile * (int)Ingredients.moonwater:
            //vec.Set(13*location, 10, 0);
            target.SetStatus(StatusScript.States.sleepy);
            return("Moon Tea");

        case (int)Ingredients.crystal * (int)Ingredients.honey * (int)Ingredients.butterfly:
            vec.Set(15 * location, 10, 0);
            GameObject.Instantiate(Resources.Load("Potions/Liquid gold"), vec, Quaternion.identity); return("Liquid gold");

        default:
            return("None");
        }
    }