Exemple #1
0
 private Bullet(Bullet bullet)
     : base(bullet)
 {
 }
Exemple #2
0
        private void Shoot()
        {
            var bulletX = X;
            var bulletY = (PlayerNumber == 1) ? Y - 1 : Y + 1;

            var bullet = new Bullet(PlayerNumber) { X = bulletX, Y = bulletY };

            try
            {
                GetMap().AddEntity(bullet);
            }
            catch (CollisionException ex)
            {
                //undo
                if (ex.Entity.GetType() == typeof(Bullet))
                {
                    GetMap().AddKillEntity(new NodeEntity(Match.GetInstance().Depth, ex.Entity, isBulletKill: true));
                }
                else
                {
                    GetMap().AddKillEntity(new NodeEntity(Match.GetInstance().Depth, ex.Entity));
                }
                ex.Entity.Destroy();
            }
        }