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); } }
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); } }
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); } }