示例#1
0
 // This method subscribes to EnabledChanged event of the bullets that CurrentShotBulletsList holds,
 // In order to "dispose" of unnecessary bullets and make space for new bullets to come.
 private void Bullet_Disposed(object i_Bullet, EventArgs i_EventArgs)
 {
     if (i_Bullet is Bullet)
     {
         CurrentShotBulletsList.Remove((Bullet)i_Bullet);
         OnBulletDisappear();
     }
 }
示例#2
0
 public void ShootBullet()
 {
     if (CurrentShotBulletsList.Count < MaxCapacity)
     {
         OnBulletShot();
         Bullet shotBullet = new Bullet(BulletOriginObject.Game, BulletOriginObject);
         setBulletPosition(shotBullet);
         shotBullet.Disposed += Bullet_Disposed;
         CurrentShotBulletsList.Add(shotBullet);
     }
 }