Beispiel #1
0
    public void SpellCast(GardenPlot plot)
    {
        PlotData data;
        Mana     mana = GameObject.FindObjectOfType <Mana>();

        if (!plots.TryGetValue(plot.gameObject.name, out data))
        {
            return;
        }
        if (rl.activeSpell.SpellName.Equals("Wild Growth") && data.stage == Status.harvestable)
        {
            return;
        }

        if (rl.activeSpell.SpellName.Equals("Wild Growth"))
        {
            plot.gameObject.GetComponents <AudioSource>()[2].Play();
            data.index++;
            if (data.index == (rl.seeds[data.type].GrowthStages - 1))
            {
                data.stage = Status.harvestable;
            }

            SpriteRenderer[] renderers = GameObject.Find(plot.gameObject.name).GetComponentsInChildren <SpriteRenderer>();
            for (int i = 1; i < 4; i++)
            {
                renderers[i].sprite = Resources.LoadAll <Sprite>("Plants/" + data.type)[data.index];
            }

            plot.gameObject.GetComponentInChildren <Animator>().SetTrigger("Growth");
            plots[plot.gameObject.name] = data;
        }
        else if (rl.activeSpell.SpellName.Equals("Ignite"))
        {
            if (GameObject.FindObjectOfType <SteamAchievementManager>() != null)
            {
                sam.UnlockAchievement(sam.m_Achievements[8]);
            }
            plot.gameObject.GetComponents <AudioSource>()[1].Play();
            plot.gameObject.GetComponentInChildren <Animator>().SetTrigger("Ignite");
            SpriteRenderer[] renderers = GameObject.Find(plot.gameObject.name).GetComponentsInChildren <SpriteRenderer>();
            for (int i = 1; i < 4; i++)
            {
                renderers[i].sprite = null;
            }
            plots.Remove(plot.gameObject.name);
            Inventory.Add(rl.ingredients["ash"], 1, true);
        }

        mana.UpdateMana(rl.activeSpell.Cost);
    }
Beispiel #2
0
    public void TakePotion()
    {
        if (Inventory.Add(pot, 1, false))
        {
            potionName.text = "";
            potionImage.GetComponent <CanvasGroup>().alpha = 0;

            anims[0].SetBool("full", false);
            SwapVisible(brew.GetComponent <CanvasGroup>());
            SwapVisible(take.GetComponent <CanvasGroup>());
            SwapVisible(brewPanel.GetComponent <CanvasGroup>());
            brewVisible = false;
            bubbles.GetComponent <SpriteRenderer>().enabled = false;

            manager.Brewing = 0;
            manager.Pot     = null;
            done            = false;
            if (GameObject.FindObjectOfType <SteamAchievementManager>() != null)
            {
                switch (pot.Primary)
                {
                case Ingredient.Attributes.dyeBlack:
                case Ingredient.Attributes.dyeBlue:
                case Ingredient.Attributes.dyeGreen:
                case Ingredient.Attributes.dyePurple:
                case Ingredient.Attributes.dyeRed:
                case Ingredient.Attributes.dyeWhite:
                case Ingredient.Attributes.dyeYellow:
                    sam.UnlockAchievement(sam.m_Achievements[0]);
                    sam.UnlockAchievement(sam.m_Achievements[7]);
                    break;

                case Ingredient.Attributes.healing:
                    sam.UnlockAchievement(sam.m_Achievements[0]);
                    sam.UnlockAchievement(sam.m_Achievements[2]);
                    break;

                case Ingredient.Attributes.speed:
                    sam.UnlockAchievement(sam.m_Achievements[0]);
                    sam.UnlockAchievement(sam.m_Achievements[1]);
                    break;

                case Ingredient.Attributes.invisibility:
                    sam.UnlockAchievement(sam.m_Achievements[0]);
                    sam.UnlockAchievement(sam.m_Achievements[3]);
                    break;

                case Ingredient.Attributes.transformation:
                    sam.UnlockAchievement(sam.m_Achievements[0]);
                    sam.UnlockAchievement(sam.m_Achievements[6]);
                    break;

                case Ingredient.Attributes.poison:
                    sam.UnlockAchievement(sam.m_Achievements[0]);
                    sam.UnlockAchievement(sam.m_Achievements[4]);
                    break;

                case Ingredient.Attributes.sleep:
                    sam.UnlockAchievement(sam.m_Achievements[0]);
                    sam.UnlockAchievement(sam.m_Achievements[5]);
                    break;

                case Ingredient.Attributes.mana:
                    sam.UnlockAchievement(sam.m_Achievements[0]);
                    sam.UnlockAchievement(sam.m_Achievements[14]);
                    break;

                default:
                    break;
                }
            }
        }
    }