예제 #1
0
        public void InitializeSprites(ContentManager Content)
        {
            for (GunLevelUnit gunLevel = 0; gunLevel < Units.MaxGunLevel; gunLevel++)
            {
                horizontalProjectiles[gunLevel] = new Sprite(Content, "Bullet",
                                                             Units.TileToPixel(HorizontalProjectileSourceXs[gunLevel]), Units.TileToPixel(ProjectileSourceYs[gunLevel]),
                                                             Units.TileToPixel(1), Units.TileToPixel(1));
                verticalProjectiles[gunLevel] = new Sprite(Content, "Bullet",
                                                           Units.TileToPixel(HorizontalProjectileSourceXs[gunLevel] + 1), Units.TileToPixel(ProjectileSourceYs[gunLevel]),
                                                           Units.TileToPixel(1), Units.TileToPixel(1));
            }

            for (SpriteState.HorizontalFacing horizontalFacing = SpriteState.HorizontalFacing.FirstHorizontalFacing;
                 horizontalFacing < SpriteState.HorizontalFacing.LastHorizontalFacing;
                 ++horizontalFacing)
            {
                for (SpriteState.VerticalFacing verticalFacing = SpriteState.VerticalFacing.FirstVerticalFacing;
                     verticalFacing < SpriteState.VerticalFacing.LastVerticalFacing;
                     ++verticalFacing)
                {
                    InitializeSprite(Content, new PolarStarSpriteState(
                                         new Tuple <SpriteState.HorizontalFacing, SpriteState.VerticalFacing>(
                                             horizontalFacing, verticalFacing)));
                }
            }
        }
예제 #2
0
        public void Draw(SpriteBatch spriteBatch, GunLevelUnit gunLevel,
                         GunExperienceUnit currentExperience, GunExperienceUnit levelExpereince)
        {
            levelSprite.Draw(spriteBatch,
                             Units.TileToGame(LevelDrawX),
                             DrawY);
            number.number = Convert.ToInt32(gunLevel);
            number.LoadNumber();
            number.Draw(spriteBatch, LevelNumberDrawX, DrawY);
            experienceBarSprite.Draw(spriteBatch,
                                     ExperienceBarDrawX, DrawY);

            if (currentExperience < levelExpereince)
            {
                fillSprite.SetPercentageWidth((float)currentExperience / (float)levelExpereince);
                fillSprite.Draw(spriteBatch, ExperienceBarDrawX, DrawY);
            }
            else
            {
                maxSprite.Draw(spriteBatch, ExperienceBarDrawX, DrawY);
            }

            if (flashTimer.Active && flashTimer.CurrentTime.Ticks / FlashPeriod.Ticks % 2 == 0)
            {
                flashSprite.Draw(spriteBatch, ExperienceBarDrawX, DrawY);
            }
        }
예제 #3
0
 public Projectile(Sprite sprite,
                   SpriteState.HorizontalFacing horizontalDirection, SpriteState.VerticalFacing verticalDirection,
                   GameUnit x, GameUnit y,
                   GunLevelUnit gunLevel, ParticleTools particleTools)
 {
     this.sprite = sprite;
     this.horizontalDirection = horizontalDirection;
     this.verticalDirection   = verticalDirection;
     this.x        = x;
     this.y        = y;
     this.gunLevel = gunLevel;
     offset        = 0;
     alive         = true;
     particleTools.FrontSystem.AddNewParticle(ProjectileStarParticle.Create(particleTools.Content, x, y));
 }
예제 #4
0
 public Projectile(Sprite sprite,
     SpriteState.HorizontalFacing horizontalDirection, SpriteState.VerticalFacing verticalDirection,
     GameUnit x, GameUnit y,
     GunLevelUnit gunLevel, ParticleTools particleTools)
 {
     this.sprite = sprite;
     this.horizontalDirection = horizontalDirection;
     this.verticalDirection = verticalDirection;
     this.x = x;
     this.y = y;
     this.gunLevel = gunLevel;
     offset = 0;
     alive = true;
     particleTools.FrontSystem.AddNewParticle(ProjectileStarParticle.Create(particleTools.Content, x, y));
 }
예제 #5
0
        public void Draw(SpriteBatch spriteBatch, GunLevelUnit gunLevel,
            GunExperienceUnit currentExperience, GunExperienceUnit levelExpereince)
        {
            levelSprite.Draw(spriteBatch,
                Units.TileToGame(LevelDrawX),
                DrawY);
            number.number = Convert.ToInt32(gunLevel);
            number.LoadNumber();
            number.Draw(spriteBatch, LevelNumberDrawX, DrawY);
            experienceBarSprite.Draw(spriteBatch,
                ExperienceBarDrawX, DrawY);

            if (currentExperience < levelExpereince)
            {
                fillSprite.SetPercentageWidth((float)currentExperience / (float)levelExpereince);
                fillSprite.Draw(spriteBatch, ExperienceBarDrawX, DrawY);
            }
            else
            {
                maxSprite.Draw(spriteBatch, ExperienceBarDrawX, DrawY);
            }

            if (flashTimer.Active && flashTimer.CurrentTime.Ticks / FlashPeriod.Ticks % 2 == 0)
            {
                flashSprite.Draw(spriteBatch, ExperienceBarDrawX, DrawY);
            }
        }