コード例 #1
0
        protected override void Initialize()
        {
            lpos    = new LandingPosition[5];
            lpos[0] = new LandingPosition(new Vector2(50, 132));
            Objects.List.Add(lpos[0]);

            lpos[1] = new LandingPosition(new Vector2(70, 62));
            Objects.List.Add(lpos[1]);

            lpos[2] = new LandingPosition(new Vector2(135, 45));
            Objects.List.Add(lpos[2]);

            lpos[3] = new LandingPosition(new Vector2(150, 11));
            Objects.List.Add(lpos[3]);

            lpos[4] = new LandingPosition(new Vector2(170, 132));
            Objects.List.Add(lpos[4]);

            SpawnPigeon();

            ambience  = contentManager.Load <Song>("ambience");
            shutter   = contentManager.Load <SoundEffect>("shutter");
            partyhorn = contentManager.Load <SoundEffect>("partyhorn");
            MediaPlayer.Play(ambience);
            MediaPlayer.IsRepeating = true;

            for (int z = 0; z < maxPhotos; z++)
            {
                icons[z] = new PhotoIcon(new Vector2(z * 22 + 2, 200 - 27));
                Objects.List.Add(icons[z]);
            }

            base.Initialize();
        }
コード例 #2
0
        void SpawnPigeon()
        {
            int             index   = rand.Next(lpos.Length);
            LandingPosition landing = lpos[index];

            if (!landing.occupied)
            {
                Pigeon pigeon = new Pigeon(landing);
                Objects.List.Add(pigeon);
            }
        }
コード例 #3
0
        public Pigeon(LandingPosition land)
        {
            northSprites  = new Texture2D[3];
            eastSprites   = new Texture2D[3];
            southSprites  = new Texture2D[3];
            westSprites   = new Texture2D[3];
            flyingSprites = new Texture2D[4];

            northSprites[0]  = Game1.contentManager.Load <Texture2D>("N1");
            northSprites[1]  = Game1.contentManager.Load <Texture2D>("N2");
            northSprites[2]  = Game1.contentManager.Load <Texture2D>("N3");
            eastSprites[0]   = Game1.contentManager.Load <Texture2D>("E1");
            eastSprites[1]   = Game1.contentManager.Load <Texture2D>("E2");
            eastSprites[2]   = Game1.contentManager.Load <Texture2D>("E3");
            southSprites[0]  = Game1.contentManager.Load <Texture2D>("S1");
            southSprites[1]  = Game1.contentManager.Load <Texture2D>("S2");
            southSprites[2]  = Game1.contentManager.Load <Texture2D>("S3");
            westSprites[0]   = Game1.contentManager.Load <Texture2D>("W1");
            westSprites[1]   = Game1.contentManager.Load <Texture2D>("W2");
            westSprites[2]   = Game1.contentManager.Load <Texture2D>("W3");
            flyingSprites[0] = Game1.contentManager.Load <Texture2D>("F1");
            flyingSprites[1] = Game1.contentManager.Load <Texture2D>("F2");
            flyingSprites[2] = Game1.contentManager.Load <Texture2D>("F3");
            flyingSprites[3] = Game1.contentManager.Load <Texture2D>("F4");

            flap = Game1.contentManager.Load <SoundEffect>("flap");

            landingPosition = land;
            landingPos      = landingPosition.position;
            land.occupied   = true;
            currentSprite   = eastSprites[2];

            position = new Vector2(Game1.rand.Next(0, 250), -30);
            if (position.X > landingPos.X)
            {
                spriteEffects = SpriteEffects.FlipHorizontally;
            }
            else
            {
                spriteEffects = SpriteEffects.None;
            }
        }