Пример #1
2
        public Projectile Shoot(Projectile.ProjectileType pt, Direction d)
        {
            Point projectileLocation = new Point(Sprite.Location.X + (Sprite.Width / 2), Sprite.Location.Y + (Sprite.Height / 2));
            Projectile pr = new Projectile();
            switch (pt)
            {
                case Projectile.ProjectileType.Bullet:
                    pr = new Bullet(this, projectileLocation);
                    pr.Direction = d;
                    pr.SetController(controller);
                    pr.StartMoving();
                    break;

                case Projectile.ProjectileType.Laser:
                    if (d != Direction.Stop)
                    {
                        pr = new Laser(this, projectileLocation, d);
                        pr.SetController(controller);
                        pr.StartMoving();
                    }
                    break;

                //case Projectile.ProjectileType.Missile:
                //    pr = new Missile(this, projectileLocation, GetRandomEnemy(this));
                //    pr.SetController(controller);
                //    pr.StartMoving();
                //    break;
            }
            return pr;
        }