Example #1
0
        public Bird(BirdFlock flock, int nrInFlock)
        {
            this.flock = flock;

            this.nrInFlock = nrInFlock;

            this.scale = new Vector2(1f, 1f);
            this.speed = new Vector2(5f, 0f);

            this.animator = new Animator(BIRD_TEXTURE, new Rectangle(0, 0, 236, 288), 100);

            int offset = (nrInFlock % 2 != 0) ? 200 : 235;

            Random random = new Random();
            offset += random.Next(300);

            switch (this.flock.direction)
            {
                case BirdFlock.FlyDirection.LeftToRight:
                    this.location = new Vector2(-200 + (70 * nrInFlock), offset);
                    break;
                case BirdFlock.FlyDirection.RightToLeft:
                    this.location = new Vector2(Game1.GetInstance().graphics.PreferredBackBufferWidth + 100 + (70 * nrInFlock), offset);
                    this.speed *= -1;
                    break;
            }

            float tempScale = 0.2f;//(0.2f + (0.005f * random.Next(10)));
            this.scale = new Vector2(tempScale - 0.05f, tempScale);

            this.z = 0.99f;

            BirdManager.GetInstance().birds.AddLast(this);
        }
Example #2
0
        public BannerBird(BirdFlock flock, int nrInFlock, String bannerText)
            : base(flock, 0)
        {
            bannerTexture = BANNER_TEXTURE;
            this.bannerScale = new Vector2(0.5f, 0.5f);
            this.speed = new Vector2(2.5f, 0f);

            this.location = new Vector2(
                this.location.X - (nrInFlock * 25),
                300 + (nrInFlock * this.GetDrawRectangle().Height));

            this.bannerText = bannerText;

            this.font = (nrInFlock == 0) ? HEADER_FONT : CONTENT_FONT;

            this.textSize = this.font.MeasureString(this.bannerText);
        }
Example #3
0
        public void Update()
        {
            double updateStart = GameTimeManager.GetInstance().currentUpdateStartMS;
            if (updateStart - this.lastSpawnMS > this.spawnInterval && this.creditsStrings.Count > 0)
            {
                this.lastSpawnMS = updateStart;

                BirdFlock flock = new BirdFlock(BirdFlock.FlyDirection.LeftToRight, 0);

                String[] texts = this.creditsStrings.First.Value;
                for (int i = 0; i < texts.Length; i++)
                {
                    new BannerBird(flock, i, texts[i]);
                }

                this.creditsStrings.RemoveFirst();
            }
            else if (updateStart - this.creationTime > this.totalDuration)
            {
                // Re-show the main menu
                if (MenuManager.GetInstance().GetCurrentMenu() != null)
                    MenuManager.GetInstance().GetCurrentMenu().visible = true;
            }
        }