Beispiel #1
0
 public void ReInitialize(Vector2 i_Delta, ICapableShooter i_Shooter)
 {
     Delta     = i_Delta;
     m_Shooter = i_Shooter;
     Initialize();
     Visible = true;
 }
Beispiel #2
0
 public Bullet(Game i_InvadersGame, Vector2 i_Delta, Enums.eShooter i_BulletShooter, ICapableShooter i_Shooter)
     : base(k_AssetName, i_InvadersGame, i_Delta)
 {
     r_BulletShooter = i_BulletShooter;
     r_Random        = new Random();
     m_Shooter       = i_Shooter;
     m_TintColor     = i_Shooter.BulletTintColor;
     m_Velocity      = new Vector2(0, i_Shooter.BulletDirection * k_BulletVelocity);
 }
        public bool Shoot(Vector2 i_Delta, ICapableShooter i_Shooter)
        {
            bool   shootSucceed = false;
            Bullet bulletToShoot;

            if (r_BulletsOnScreen.Count < r_MaxBulletsOnScreen)
            {
                if (r_BulletsReadyToShoot.Count > 0)
                {
                    bulletToShoot = r_BulletsReadyToShoot.Pop();
                    bulletToShoot.ReInitialize(i_Delta, i_Shooter);
                }
                else
                {
                    bulletToShoot = new Bullet(Game, i_Delta, r_BulletShooter, i_Shooter);
                }

                loadBullet(bulletToShoot);
                shootSucceed = true;
                playSound();
            }

            return(shootSucceed);
        }