コード例 #1
0
 public void AddPotion()
 {
     potionInBottle.SetPotionName(potionToPull.GetPotionName());
     potionInBottle.SetPotionColor(potionToPull.GetPotionColor());
     potionInBottle.SetPotionProperty(potionToPull.GetPotionProperty());
     Debug.Log("I have a potion in me! It's name is " + potionInBottle.GetPotionName() + "!");
 }
コード例 #2
0
        void AddIngredientToPotion(GameObject g)
        {
            if (g.GetComponent <Ingredient>().GetIngredientColor() != Ingredient.Color.Null)
            {
                if (potionInPot.GetPotionColor() == Potion.Color.Null)
                {
                    potionInPot.SetPotionColor(g.GetComponent <Ingredient>().GetIngredientColor().ToString());
                    potionInPot.SetPotionColorIntensity(potionInPot.GetPotionColorIntensity() + g.GetComponent <Ingredient>().GetColIntensity());
                }
                else if (g.GetComponent <Ingredient>().GetIngredientColor().ToString() == potionInPot.GetPotionColor().ToString())
                {
                    if (potionInPot.GetPotionColorIntensity() < 3)
                    {
                        potionInPot.SetPotionColor(g.GetComponent <Ingredient>().GetIngredientColor().ToString());
                        potionInPot.SetPotionColorIntensity(potionInPot.GetPotionColorIntensity() + g.GetComponent <Ingredient>().GetColIntensity());
                    }
                    if (potionInPot.GetPotionColorIntensity() > 3)
                    {
                        potionInPot.SetPotionColorIntensity(3);
                    }
                }
                else if (potionInPot.GetPotionColor().ToString() != g.GetComponent <Ingredient>().GetIngredientColor().ToString())
                {
                    Debug.LogWarning("I'm combining colors!");
                    CreateColorCombo(g);
                }
            }

            if (g.GetComponent <Ingredient>().GetIngredientProperty() != Ingredient.Property.Null || g.GetComponent <Ingredient>().GetIngredientProperty().ToString() == potionInPot.GetPotionProperty().ToString())
            {
                if (potionInPot.GetPotionProperyIntensity() < 3)
                {
                    potionInPot.SetPotionProperty(g.GetComponent <Ingredient>().GetIngredientProperty().ToString());
                    potionInPot.SetPotionProperyIntensity(potionInPot.GetPotionProperyIntensity() + g.GetComponent <Ingredient>().GetPropIntensity());
                    if (potionInPot.GetPotionProperyIntensity() > 3)
                    {
                        potionInPot.SetPotionProperyIntensity(3);
                    }
                }
            }
        }