private void ShootByIntervals()
    {
        if (disableAll)
        {
            if (bulletType.Equals(BulletType.Bouncy))
            {
                ObjectPooler.SharedInstanceBouncy.DisableAllBullets();
            }
            else if (bulletType.Equals(BulletType.Pong))
            {
                ObjectPooler.SharedInstanceBullet.DisableAllBullets();
            }
            else
            {
                ObjectPooler.SharedInstancePong.DisableAllBullets();
            }
        }

        if ((Time.time - startTime >= timeInterval && timeInterval != 0) || (shoot != shootState))
        {
            Shoot();
            startTime  = Time.time;
            shootState = shoot;
        }
    }
 private void Awake()
 {
     if (bulletType.Equals(BulletType.Bouncy))
     {
         SharedInstanceBouncy = this;
     }
     else if (bulletType.Equals(BulletType.Pong))
     {
         SharedInstancePong = this;
     }
     else
     {
         SharedInstanceBullet = this;
     }
 }
Example #3
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        turnsCounter = 0;
        if (other.tag == "Player" && bulletType.Equals(BulletType.Enemy) && other.gameObject.transform.position.x == transform.position.x && other.gameObject.transform.position.y == transform.position.y)
        {
            other.GetComponent <Player>().Damage();
        }

        if (other.tag == "Enemy" && bulletType.Equals(BulletType.Player) && other.gameObject.transform.position.x == transform.position.x && other.gameObject.transform.position.y == transform.position.y)
        {
            other.GetComponent <Enemy>().Damage();
        }

        this.gameObject.SetActive(false);
    }
Example #4
0
 public MachineGunBullet(BulletType bulletType, float damage)
 {
     this.bulletType = bulletType;
     this.damage     = damage;
     if (bulletType.Equals(BulletType.bustBullet))
     {
         damage *= 2f;
     }
 }
Example #5
0
 public LazerBullet(BulletType bulletType, float damage)
 {
     this.bulletType = bulletType;
     this.damage     = damage;
     if (bulletType.Equals(BulletType.bustEnergy))
     {
         damage *= 2f;
     }
 }