Пример #1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (can_despawn)
        {
            if (col.tag == "Enemy")
            {
                if (enemy_to_ignore == null || (enemy_to_ignore != null && enemy_to_ignore != col.gameObject))
                {
                    if (GetComponent <BitterCold>())
                    {
                        GetComponent <BitterCold>().OnEnemyHit(col);
                    }

                    if (GetComponent <Nirvana>())
                    {
                        GetComponent <Nirvana>().OnEnemyHit(col);
                    }

                    if (GetComponent <Split>())
                    {
                        GetComponent <Split>().OnEnemyHit(col);
                    }

                    GameObject obj;

                    if (GetComponent <BitterCold>())
                    {
                        obj = PoolManager.Spawn(impact_effect_blue, transform.position, Quaternion.identity);
                    }
                    else
                    {
                        obj = PoolManager.Spawn(impact_effect_red, transform.position, Quaternion.identity);
                    }
                    PoolManager.Despawn(obj, 2f);
                    can_despawn = false;
                    DamageTextManager.CreatePopupText(damage.ToString(), col.transform);
                    col.GetComponent <EnemyController>().TakeHealth(damage);
                    PoolManager.Despawn(gameObject);
                }
            }
            else if (col.tag == "Ground")
            {
                GameObject obj;

                if (GetComponent <BitterCold>())
                {
                    obj = PoolManager.Spawn(impact_effect_blue, transform.position, Quaternion.identity);
                }
                else
                {
                    obj = PoolManager.Spawn(impact_effect_red, transform.position, Quaternion.identity);
                }

                PoolManager.Despawn(obj, 2f);
                can_despawn = false;

                PoolManager.Despawn(gameObject);
            }
        }
    }
Пример #2
0
    private void Update()
    {
        if (currentLife <= 0)
        {
            PoolManager.Despawn(gameObject);
        }

        currentLife -= Time.deltaTime;

        if (stamp <= Time.time)
        {
            stamp = Time.time + rate;
            Collider2D[] hits = Physics2D.OverlapCircleAll(transform.position, range);
            for (int i = 0; i < hits.Length; i++)
            {
                if (hits[i].tag == "Enemy")
                {
                    DamageTextManager.CreatePopupText(((int)damage).ToString(), hits[i].transform);
                    hits[i].GetComponent <EnemyController>().TakeHealth((int)damage);
                }
            }
        }
    }
Пример #3
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (can_despawn)
        {
            if (col.tag == "Enemy")
            {
                GameObject obj       = PoolManager.Spawn(impact_effect, transform.position, Quaternion.identity);
                GameObject impactDmg = PoolManager.Spawn(impact_damage, transform.position, Quaternion.identity);
                ActionCamera.singleton.StartShake(.15f, .05f);

                if (ArcaneBomb.singleton.rune1 == ArcaneBomb.Rune.Tremendous || ArcaneBomb.singleton.rune2 == ArcaneBomb.Rune.Tremendous)
                {
                    obj.transform.localScale       = new Vector3(1.5f, 1.5f, 1.5f);
                    impactDmg.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
                    for (int i = 0; i < obj.transform.childCount; i++)
                    {
                        obj.transform.GetChild(i).localScale = new Vector3(1.5f, 1.5f, 1.5f);
                    }
                }
                else
                {
                    obj.transform.localScale       = new Vector3(1f, 1f, 1f);
                    impactDmg.transform.localScale = new Vector3(1f, 1f, 1f);
                    for (int i = 0; i < obj.transform.childCount; i++)
                    {
                        obj.transform.GetChild(i).localScale = new Vector3(1f, 1f, 1f);
                    }
                }

                if (GetComponent <Tremendous>())
                {
                    impactDmg.GetComponent <BombImpactController>().damage = damage * (int)GetComponent <Tremendous>().damageMultiplier;
                }
                else
                {
                    impactDmg.GetComponent <BombImpactController>().damage = damage;
                }
                PoolManager.Despawn(obj, 5);
                PoolManager.Despawn(impactDmg, .1f);

                DamageTextManager.CreatePopupText(damage.ToString(), col.transform);

                if (GetComponent <Gas>())
                {
                    GameObject gas = PoolManager.Spawn(impact_gas, transform.position, Quaternion.identity);
                    if (GetComponent <Tremendous>())
                    {
                        gas.GetComponent <DOT>().damage = damage * (int)GetComponent <Tremendous>().damageMultiplier / 4f;
                    }
                    else
                    {
                        gas.GetComponent <DOT>().damage = damage / 4;
                    }
                }

                if (GetComponent <Bounce>())
                {
                    GetComponent <Bounce>().DoBounce(col);
                }
                else
                {
                    can_despawn = false;
                    PoolManager.Despawn(gameObject);
                }
            }
            else if (col.tag == "Ground")
            {
                GameObject obj = PoolManager.Spawn(impact_effect, transform.position, Quaternion.identity);
                PoolManager.Despawn(obj, 5);
                ActionCamera.singleton.StartShake(.15f, .05f);

                if (ArcaneBomb.singleton.rune1 == ArcaneBomb.Rune.Tremendous || ArcaneBomb.singleton.rune2 == ArcaneBomb.Rune.Tremendous)
                {
                    obj.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
                    for (int i = 0; i < obj.transform.childCount; i++)
                    {
                        obj.transform.GetChild(i).localScale = new Vector3(1.5f, 1.5f, 1.5f);
                    }
                }
                else
                {
                    obj.transform.localScale = new Vector3(1f, 1f, 1f);
                    for (int i = 0; i < obj.transform.childCount; i++)
                    {
                        obj.transform.GetChild(i).localScale = new Vector3(1f, 1f, 1f);
                    }
                }

                GameObject impactDmg = PoolManager.Spawn(impact_damage, transform.position, Quaternion.identity);
                if (GetComponent <Tremendous>())
                {
                    impactDmg.GetComponent <BombImpactController>().damage = damage * (int)GetComponent <Tremendous>().damageMultiplier;
                }
                else
                {
                    impactDmg.GetComponent <BombImpactController>().damage = damage;
                }

                if (GetComponent <Gas>())
                {
                    GameObject gas = PoolManager.Spawn(impact_gas, transform.position, Quaternion.identity);
                    if (GetComponent <Tremendous>())
                    {
                        gas.GetComponent <DOT>().damage = damage * (int)GetComponent <Tremendous>().damageMultiplier / 4f;
                    }
                    else
                    {
                        gas.GetComponent <DOT>().damage = damage / 4;
                    }
                }

                PoolManager.Despawn(impactDmg, .1f);
                can_despawn = false;
                PoolManager.Despawn(gameObject);
            }
        }
    }