public void CreateExplosion(Vector3 position) { _audioSource.Play(); FloatingObject smoke_clone = _smokePool.GetObject() as FloatingObject; smoke_clone.transform.position = position; StartCoroutine(smoke_clone.ReturnToPool(_smoke.GetComponent <ParticleSystem>().duration * 2)); FloatingObject explosion_clone = _explosionPool.GetObject() as FloatingObject; explosion_clone.transform.position = position; StartCoroutine(explosion_clone.ReturnToPool(_sparkDuration)); }
private void Start() { _ballsPool = new ObjectsPool(1, _ball); Hoop.Goal += delegate(){ Vector2 NewBallPosition = new Vector2(Random.Range(-15, 15), Random.Range(-10, 18)); while (NewBallPosition == OldBallPosition) { NewBallPosition = new Vector2(Random.Range(-15, 15), Random.Range(-10, 18)); } _ball.ReturnToPool(); _ball = _ballsPool.GetObject(); _ball.GetComponent <BallBehaviour>().SetBall(NewBallPosition); OldBallPosition = NewBallPosition; }; }
public void BombDetonation() { _isGrounded = false; SpecialEffectsManager.Instance.CreateExplosion(this.transform.position); _floatingObject.ReturnToPool(); }