Ejemplo n.º 1
0
    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));
    }
Ejemplo n.º 2
0
    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;
        };
    }
Ejemplo n.º 3
0
 public void BombDetonation()
 {
     _isGrounded = false;
     SpecialEffectsManager.Instance.CreateExplosion(this.transform.position);
     _floatingObject.ReturnToPool();
 }