コード例 #1
0
        private Vector2 rotateBuffer = new Vector2(0, 0); // sin = X , cos = Y

        #endregion Fields

        #region Constructors

        public BaseTurretGun(Game game, SpriteBatch batch, Vector2 screenPosition, float scale, ProjectileHandlerGroup shotHandlerGroup)
            : base(game)
        {
            this.spriteBatch = batch;
            this.shotHandlerGroup = shotHandlerGroup;
            this.scale = scale;
            rotation = 0;
            this.screenPosition = screenPosition;
        }
コード例 #2
0
 public PlanetBasis(Game game, SpriteBatch batch, ProjectileHandlerGroup projectileHandlerGroup)
     : base(game)
 {
     // TODO: Construct any child components here
     spriteBatch = batch;
     position = new Vector2( 960,540);
     gun1 = new TurretGunDefaultBullet(Game, spriteBatch, position + new Vector2(0,-25), 0.7f, projectileHandlerGroup);
     gun2 = new TurretGunDefaultBullet(Game, spriteBatch, position + new Vector2(-25, 0), 0.7f, projectileHandlerGroup);
     gun3 = new TurretGunDefaultBullet(Game, spriteBatch, position + new Vector2(0, 25), 0.7f, projectileHandlerGroup);
     gun4 = new TurretGunDefaultBullet(Game, spriteBatch, position + new Vector2(25, 0), 0.7f, projectileHandlerGroup);
 }
 public TurretGunDefaultBullet(Game game, SpriteBatch batch, Vector2 screenPosition, float scale, ProjectileHandlerGroup shotHandlerGroup)
     : base(game, batch, screenPosition, scale, shotHandlerGroup)
 {
     turrets.Add(new TurretDefaultBullet(Game, spriteBatch, scale, shotHandlerGroup.GetNewHandler(this)));
     turrets.Last().Initialize();
     turrets.Add(new TurretDefaultBullet(Game, spriteBatch, scale, shotHandlerGroup.GetNewHandler(this)));
     turrets.Last().Initialize();
     rotation = 0;
     turretOrigins.Add(new Vector2(7 , -4) *scale);
     turretOrigins.Add(new Vector2(-7 , -4)* scale);
 }
コード例 #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            // TODO: use this.Content to load your game content here
            shotHandlerGroup = new ProjectileHandlerGroup(this, spriteBatch);
            shotHandlerGroup.Initialize();

            bg = new Background(this as Game);
            bg.Initialize();
            fps = new FPSCounter(this as Game);
            fps.Initialize();
            planet = new HomePlanet(this as Game);
            planet.Initialize();
            planetHud = new PlanetStatusDisplay(this as Game, planet as HomePlanet);
            planetHud.Initialize();
            planetBasis = new PlanetBasis(this as Game,spriteBatch,shotHandlerGroup);
            planetBasis.Initialize();
            enemy = new BaseEnemy(this, spriteBatch, 1.0f, new Vector2(900, 800));
            enemy.Initialize();
        }