コード例 #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
ファイル: PolarStar.cs プロジェクト: coler706/CaveStory
 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);
            }
        }