Example #1
0
    private void RetirarEfeito(Object_Efeitos.Effects efeito)
    {
        switch (efeito)
        {
        case Object_Efeitos.Effects.DAMAGE_UP:

            this.GetComponent <Animator>().SetBool("PowerBuff", false);
            this.GetComponent <TrailRenderer>().enabled              = false;
            this.GetComponent <Characters_Player>().AttackBuff       = false;
            this.GetComponent <Characters_Player>().DamageMultiplier = 1;
            break;

        case Object_Efeitos.Effects.DAMAGE_DOWN:
            this.GetComponent <Animator>().SetBool("PowerDown", false);
            this.GetComponent <Characters_Player>().DamageMultiplier = 1;
            break;

        case Object_Efeitos.Effects.SPEED_UP:
            this.GetComponent <Characters_Player>().speedMultiplier = 1;
            this.GetComponent <Animator>().SetBool("SpeedBuff", false);
            this.GetComponent <TrailRenderer>().enabled = false;
            break;

        case Object_Efeitos.Effects.SPEED_DOWN:
            this.GetComponent <Animator>().SetBool("SpeedDown", false);
            this.GetComponent <Characters_Player>().speedMultiplier = 1;
            break;

        case Object_Efeitos.Effects.INVERT_CONTROL:
            this.GetComponent <Characters_Player>().invertControl = false;
            this.GetComponent <Animator>().SetBool("SpeedDown", false);
            break;
        }
        this.comEfeito = false;
    }
Example #2
0
    private void ReceberEfeito(Object_Efeitos.Effects efeito)
    {
        switch (efeito)
        {
        case Object_Efeitos.Effects.DAMAGE_UP:
            this.GetComponent <Animator>().SetBool("PowerBuff", true);
            this.GetComponent <TrailRenderer>().material             = this.powerUpMat;
            this.GetComponent <TrailRenderer>().enabled              = true;
            this.GetComponent <Characters_Player>().AttackBuff       = true;
            this.GetComponent <Characters_Player>().DamageMultiplier = multiDamageUp;
            this.scoreManager.ItemsGot[0]++;

            break;

        case Object_Efeitos.Effects.DAMAGE_DOWN:
            GameObject[] listaPrefab2;
            this.GetComponent <Animator>().SetBool("PowerDown", true);
            listaPrefab2 = this.GetComponent <Characters_Player>().PrefabList.ToArray();
            this.GetComponent <Characters_Player>().AttackBuff       = false;
            this.GetComponent <Characters_Player>().DamageMultiplier = multiDamageDown;
            this.scoreManager.ItemsGot[1]++;

            break;

        case Object_Efeitos.Effects.SPEED_UP:
            this.GetComponent <Characters_Player>().speedMultiplier = this.multiSpeedUp;
            this.GetComponent <TrailRenderer>().material            = this.speedUpMat;
            this.GetComponent <Animator>().SetBool("SpeedBuff", true);
            this.GetComponent <TrailRenderer>().enabled = true;
            this.scoreManager.ItemsGot[2]++;

            break;

        case Object_Efeitos.Effects.SPEED_DOWN:
            this.GetComponent <Animator>().SetBool("SpeedDown", true);
            this.GetComponent <Characters_Player>().speedMultiplier = this.multiSpeedDown;
            this.scoreManager.ItemsGot[3]++;
            break;

        case Object_Efeitos.Effects.INVERT_CONTROL:
            this.GetComponent <Characters_Player>().invertControl = true;
            this.GetComponent <Animator>().SetBool("SpeedDown", true);

            break;
        }
        this.comEfeito = true;
    }
Example #3
0
    void OnTriggerEnter2D(Collider2D coll)
    {
        if (coll.gameObject.tag.Equals("Item"))
        {
            if (this.comEfeito)
            {
                RetirarEfeito(this.auxEfeito);
            }

            this.auxEfeito = coll.gameObject.GetComponent <Object_Efeitos>().GetEfeitoAtual();
            Item i = coll.GetComponent <Item> ();
            i.enabled = false;
            i.itemController.Decrease(i.effect.ToString());

            this.GetComponent <Characters_Global>().Prov_PowerUp(auxEfeito.ToString(), coll.GetInstanceID().ToString());

            ReceberEfeito(auxEfeito);
            Destroy(coll.gameObject);
        }
    }
    private Object_Efeitos.Effects RandomEffect(GameObject gameObjAtual)
    {
        int aux;

        if (!this.random)
        {
            aux = this.effectOrder[this.currPowerUp];
        }
        else
        {
            List <int> powerUpPool = new List <int>();

            // Damage Up
            for (int j = 0; j < 25 * this.balanceApplier.itemDistances[1]; j++)
            {
                powerUpPool.Add(0);
            }
            // Damage Down
            for (int j = 0; j < 25 * this.balanceApplier.itemDistances[0]; j++)
            {
                powerUpPool.Add(1);
            }
            // Speed Up
            for (int j = 0; j < 25 * this.balanceApplier.itemDistances[3]; j++)
            {
                powerUpPool.Add(2);
            }
            // Damage Down
            for (int j = 0; j < 25 * this.balanceApplier.itemDistances[2]; j++)
            {
                powerUpPool.Add(3);
            }

            aux = powerUpPool[Random.Range(0, powerUpPool.Count)];
            this.spawnedItems[aux]++;
        }
        switch (aux)
        {
        case 0:
            auxEffect = Object_Efeitos.Effects.DAMAGE_UP;
            gameObjAtual.GetComponent <SpriteRenderer>().color = colorDamageUp;
            gameObjAtual.GetComponent <Animator>().SetTrigger("Good");
            gameObjAtual.GetComponent <SpriteRenderer>().sprite = spriteDamageUp;
            break;

        case 1:
            auxEffect = Object_Efeitos.Effects.DAMAGE_DOWN;
            gameObjAtual.GetComponent <SpriteRenderer>().color = colorDamageDown;
            gameObjAtual.GetComponent <Animator>().SetTrigger("Bad");
            gameObjAtual.GetComponent <SpriteRenderer>().sprite = spriteDamageDown;
            break;

        case 2:
            auxEffect = Object_Efeitos.Effects.SPEED_UP;
            gameObjAtual.GetComponent <Animator>().SetTrigger("Good");
            gameObjAtual.GetComponent <SpriteRenderer>().color  = colorSpeedUp;
            gameObjAtual.GetComponent <SpriteRenderer>().sprite = spriteSpeedUp;
            break;

        case 3:
            auxEffect = Object_Efeitos.Effects.SPEED_DOWN;
            gameObjAtual.GetComponent <Animator>().SetTrigger("Bad");
            gameObjAtual.GetComponent <SpriteRenderer>().color  = colorSpeedDown;
            gameObjAtual.GetComponent <SpriteRenderer>().sprite = spriteSpeedDown;
            break;

        case 4:
            auxEffect = Object_Efeitos.Effects.INVERT_CONTROL;
            gameObjAtual.GetComponent <Animator>().SetTrigger("Bad");
            gameObjAtual.GetComponent <SpriteRenderer>().color  = colorInvert;
            gameObjAtual.GetComponent <SpriteRenderer>().sprite = spriteColorInvert;
            break;
        }
        gameObjAtual.GetComponent <Item>().itemController = this.itemController;
        gameObjAtual.GetComponent <Item>().effectId       = aux;
        itemController.Increase(auxEffect.ToString());

        Prov_SpawnItem();
        Prov_Item(auxEffect.ToString(), gameObjAtual.GetComponent <Collider2D>().GetInstanceID().ToString());
        return(auxEffect);
    }