Beispiel #1
0
        public void BuildField(float size)
        {
            while (Bees.Count < 50)
            {
                Bee bee = new Bee();
                bee.model = random.Next(4);
                bee.position = RandomVector(-100, 100);
                bee.velocity = RandomVector(-.1f, .1f);
                bee.size = 3;
                bee.noise = 0;

                if (((bee.position.X < 10 && bee.position.X > -10) || (bee.position.Y < 10 ) || (bee.position.Z < 10 && bee.position.Z > -10)))
                    continue;

                Bees.AddLast(bee);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            this.IsMouseVisible = true;

            //Change the resolution to 800x600

            graphics.PreferredBackBufferWidth = 800;

            graphics.PreferredBackBufferHeight = 600;

            graphics.ApplyChanges();

            // TODO: Add your initialization logic here

            mBeeSprite = new Bee();
              //  bee2 = new Sprite();
            mStamina = new StaminaBar();

            mBackgroundOne = new Sprite();

            mBackgroundOne.Scale = 2.0f;

            mBackgroundTwo = new Sprite();

            mBackgroundTwo.Scale = 2.0f;

            mBackgroundThree = new Sprite();

            mBackgroundThree.Scale = 2.0f;

            mBackgroundFour = new Sprite();

            mBackgroundFour.Scale = 2.0f;

            mBackgroundFive = new Sprite();

            mBackgroundFive.Scale = 2.0f;

            base.Initialize();
        }
Beispiel #3
0
        private void DrawModel(GraphicsDeviceManager graphics, Model model, Matrix world, Bee ast)
        {
            Matrix[] transforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(transforms);

            transforms[wing1] = Matrix.CreateRotationY(ast.wingAngle) * transforms[wing1];
            transforms[wing2] = Matrix.CreateRotationY(-ast.wingAngle) * transforms[wing2];
            transforms[head] = Matrix.CreateRotationY(ast.headAngle) * transforms[head];

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();
                    effect.World = transforms[mesh.ParentBone.Index] * world;
                    effect.View = game.Camera.View;
                    effect.Projection = game.Camera.Projection;
                }
                mesh.Draw();
            }
        }