Esempio n. 1
0
    public override void Attack(Enemy e, Bullet b)
    {
        bool cri = false;

        int randomCritical = Random.Range(1, 101);

        if (randomCritical <= critical)
        {
            cri = true;
        }

        if (cri)
        {
            e.Hit((damage + UpgradeManager.instance.blueDiceUpgrade) * 2);

            ParticleDisable p = ObjectPoolManager.instance.GetHitParticle(true);
            p.transform.position = e.transform.position;
            p.gameObject.SetActive(true);
        }
        else
        {
            e.Hit(damage + UpgradeManager.instance.blueDiceUpgrade);

            ParticleDisable p = ObjectPoolManager.instance.GetHitParticle(false);
            p.transform.position = e.transform.position;
            p.gameObject.SetActive(true);
        }
    }
Esempio n. 2
0
    public void ReturnParticle(ParticleDisable particle)
    {
        if (particle.cri)
        {
            _stack_CriticalHitParticle.Push(particle);
        }
        else
        {
            _stack_HitParticle.Push(particle);
        }

        if (particle.gameObject.activeSelf)
        {
            particle.gameObject.SetActive(false);
        }
    }
Esempio n. 3
0
    public ParticleDisable GetHitParticle(bool critical)
    {
        if (critical)
        {
            if (_stack_CriticalHitParticle.Count == 0)
            {
                MakeParticle(1, true);
            }

            ParticleDisable particle = _stack_CriticalHitParticle.Pop();
            return(particle);
        }
        else
        {
            if (_stack_HitParticle.Count == 0)
            {
                MakeParticle(1, false);
            }

            ParticleDisable particle = _stack_HitParticle.Pop();
            return(particle);
        }
    }