Esempio n. 1
0
    public void SpendDetrizide()
    {
        if (!GetComponent <Unit>().IsDead())
        {
            if (healavailable)
            {
                lefthandanim.SetTrigger("Heal");

                Debug.Log("healthcost = " + healthcost);

                unit.SetHealth(unit.GetMaxHealth());
                statl.SetDetrizide(statl.GetDetrizide() - healthcost);
                aso.PlayOneShot(sl.GetDetriHeal());
                detrilight.CreateSpellEffect("Heal", spelleffect, spellpos);
            }
            else if (summonavailable)
            {
                lefthandanim.SetTrigger("Summon");
                aso.PlayOneShot(sl.GetDetriRes());
                detrilight.CreateSpellEffect("Summon", spelleffect, spellpos);

                for (int i = 0; i < altar.GetResMax(); i++)
                {
                    if (statl.GetDetrizide() > rescost && CountFriends("Friendlies") < altar.GetResMax())
                    {
                        Debug.Log("rescost = " + rescost);
                        statl.SetDetrizide(statl.GetDetrizide() - rescost);
                        altar.ResurrectUnit();
                    }
                }
            }
            else if (bankavailable)
            {
                lefthandanim.SetTrigger("Bank");
                statl.SetDetrizideBank(statl.GetDetrizideBank() + (fastmode? statl.GetDetrizide() * 4 : statl.GetDetrizide()));
                statl.SetDetrizide(0);
                aso.PlayOneShot(sl.GetDetriBank());
                detrilight.CreateSpellEffect("Bank", spelleffect, spellpos);
                GameObject tracer = Instantiate(spendtracer, transform.position, transform.rotation);
                tracer.GetComponent <HomingProjectile>().SetDefaultTarget(wb.transform);
            }
        }
    }
Esempio n. 2
0
    private void ApplyBonus(string pickupname)
    {
        switch (pickupname)
        {
        case "SummonPlus2":
            if (statl.GetDetrizideBank() < 30000)
            {
                GetComponent <AudioSource>().PlayOneShot(sl.GetSummonUpgrade());
            }
            altar.SetResCost(altar.GetResCost() + resIncreaseFactor);
            altar.SetResMax(altar.GetResMax() + 2);
            break;

        case "Scythes":
            if (statl.GetDetrizideBank() < 30000)
            {
                GetComponent <AudioSource>().PlayOneShot(sl.GetScythe());
            }
            //replace bonebag with upgraded bonebag
            if (player.GetPlayerOwnedWeapons().Contains(sc.provideGameObject("Snubnose")))
            {
                player.AnimateSwapWeapon(player.GetCurrentWeapon(), "Snubnose");
            }
            else
            {
                player.AnimateSwapWeapon(player.GetCurrentWeapon(), "BoneBag");
            }
            sc.SetBoneBag(newBonebag);
            break;

        case "Health":
            Unit unit = player.GetComponent <Unit>();
            unit.SetMaxHealth(unit.GetMaxHealth() * 2);
            unit.SetHealth(unit.GetMaxHealth());
            break;
        }
    }
Esempio n. 3
0
    public void ColourDetrizideSpell()
    {
        if (!detrianim || !detriLight)
        {
            detriLight = GameObject.Find("DetriLight");
            detrianim  = detriLight.GetComponent <Animator>();
        }
        int healthcost = Player.GetHealthCost();
        int rescost    = Player.GetResCost();

        // priority: health > resurrections > upgrades

        if (playerunit.GetHealth() < playerunit.GetMaxHealth() && sl.GetDetrizide() > healthcost && healthcost != 0)
        {
            detrianim.SetBool("IsDetriReady", true);
            detrianim.SetBool("IsSummonReady", false);
            ChangeDLColour(healcolor);
            ResetMaterials(wb.gameObject);
            ResetMaterials(altar.gameObject);
            if (!dsprite)
            {
                dsprite = Instantiate(dspriteh, dspriteposition.transform.position, transform.rotation, dspriteposition.transform);
            }
            else if (dsprite.GetComponent <Dsprite>().GetSType() != "Heal")
            {
                Destroy(dsprite);
            }
        }
        else if (playerunit.GetHealth() == playerunit.GetMaxHealth() && sl.GetDetrizide() > rescost && Player.CountFriends("Friendlies") < altar.GetResMax())
        {
            detrianim.SetBool("IsDetriReady", false);
            detrianim.SetBool("IsSummonReady", true);
            ChangeDLColour(rescolor);

            if (!dsprite)
            {
                dsprite = Instantiate(dsprites, dspriteposition.transform.position, transform.rotation, dspriteposition.transform);
            }
            else if (dsprite.GetComponent <Dsprite>().GetSType() != "Summon")
            {
                Destroy(dsprite);
            }
        }
        else if (playerunit.GetHealth() == playerunit.GetMaxHealth() && sl.GetDetrizide() > 0)
        {
            detrianim.SetBool("IsDetriReady", true);
            detrianim.SetBool("IsSummonReady", false);
            ChangeDLColour(bankcolor);
            overwriteMaterials(benchMaterial, wb.gameObject);
            ResetMaterials(altar.gameObject);

            if (!dsprite)
            {
                dsprite = Instantiate(dspriteb, dspriteposition.transform.position, transform.rotation, dspriteposition.transform);
            }
            else if (dsprite.GetComponent <Dsprite>().GetSType() != "Bank")
            {
                Destroy(dsprite);
            }
        }
        else
        {
            detrianim.SetBool("IsDetriReady", false);
            detrianim.SetBool("IsSummonReady", false);
            ChangeDLColour(blankcolor);
            ResetMaterials(altar.gameObject);
            ResetMaterials(wb.gameObject);

            if (dsprite)
            {
                Destroy(dsprite);
            }
        }
    }