Beispiel #1
0
 public void RemoveBullet(AbstractBullet bullet)
 {
     if (bullet)
     {
         bullets.Remove(bullet);
     }
     Destroy(bullet.gameObject);
 }
 /// <summary>
 /// React to a collision with a bullet
 /// </summary>
 /// <param name="bullet"></param>
 public void ReactToCollision(AbstractBullet bullet)
 {
     if (bullet.GetGun() != this.Player.GetGun())
     {
         this.Player.DecreaseHealth(5);
         bullet.Destroy();
     }
 }
Beispiel #3
0
    private void ShootBullet()
    {
        GameObject go = Instantiate(bullet.gameObject) as GameObject;

        go.transform.position = transform.position;
        AbstractBullet bulletScript = go.GetComponent <AbstractBullet>();

        bulletScript.Setup(bossManager.boss);
    }
    protected virtual void FireBullet(Vector2 target)
    {
        AbstractBullet spawnedBullet = SimplePool.Spawn(bullet, this.transform.position).GetComponent <AbstractBullet>();

        spawnedBullet.range   = range;
        spawnedBullet.Target  = target;
        spawnedBullet.Side    = myShip.Side;
        spawnedBullet.BaseHue = myShip.BaseHue;

        visuals.rotation = (target - (Vector2)(this.transform.position)).ToRotation();
    }
Beispiel #5
0
    void Shoot()
    {
        GameObject bulletGO = (GameObject)Instantiate(bulletPrefab, firePoint.position, bulletPrefab.transform.rotation);

        AbstractBullet bullet = bulletGO.GetComponent <AbstractBullet>();

        bullet.myTower = this;

        if (bullet != null)
        {
            bullet.Seek(target);
        }
    }
 /// <summary>
 /// React to collision with a bullet
 /// </summary>
 /// <param name="bullet"></param>
 public void ReactToCollision(AbstractBullet bullet)
 {
     // Undefined
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="bullet"></param>
 public CollisionBehaviors(AbstractBullet bullet)
 {
     this.Bullet = bullet;
 }
 /// <summary>
 /// React to a collision with a bullet
 /// </summary>
 /// <param name="bullet"></param>
 public void ReactToCollision(AbstractBullet bullet)
 {
     // TODO
 }
Beispiel #9
0
 /// <summary>
 /// Set bullets
 /// </summary>
 /// <param name="bullets"></param>
 public void SetBullets(AbstractBullet[] bullets)
 {
     this.Bullets = bullets;
 }