public virtual void Draw(GraphicsDevice device, Camera camera)
        {
            Matrix[] transformation = new Matrix[model.Bones.Count];

            model.CopyAbsoluteBoneTransformsTo(transformation);

            foreach (ModelMesh mesh in model.Meshes) {
                //effects and matricies go here
                foreach (BasicEffect effect in mesh.Effects) {

                    Matrix matrix = GetWorld();
                    effect.World = mesh.ParentBone.Transform * matrix;
                    effect.View = camera.view;
                    effect.Projection = camera.projection;
                    effect.TextureEnabled = true;
                    effect.EnableDefaultLighting();
                    effect.World = transformation[mesh.ParentBone.Index] * GetWorld();

                    if (this.tintColour != null) {
                        effect.AmbientLightColor = this.tintColour;
                    }

                }
                mesh.Draw();
            }
        }
        public MonsterTruck(Model model, GraphicsDevice device, Camera camera, Vector3 position, Player playerModel, Game1 game)
            : base(model)
        {
            this.MAX_HEALTH = (int)game.truckHealth;
            this.moveSpeed = game.truckMoveSpeed;

            base.translation.Translation = position;

            this.playerModel = playerModel;
            health = MAX_HEALTH;
            Random rng = new Random();

            aStarPaths = new List<Vector2>();
            seekLocation = null;
        }
Пример #3
0
        float velocity = 0f; // need to track velocity so the car naturally slows down

        #endregion Fields

        #region Constructors

        public Player(Model model, GraphicsDevice device, Camera camera, Game1 game)
            : base(model)
        {
            this.MAX_HEALTH = (int)game.playerHealth;
            this.MOVE_SPEED = game.playerMoveSpeed;

            graphicsDeviceManager = game.graphics;
            this.uiManager = game.uiManager;
            this.audioManager = game.audioManager;

            health = MAX_HEALTH;
            energy = MAX_ENERGY;

            base.translation.Translation = new Vector3(500f, 0f, 500f);
        }
Пример #4
0
        public Enemy(Model model, GraphicsDevice device, Camera camera, Vector3 position, Player playerModel, Game1 game)
            : base(model)
        {
            this.game = game;
            this.MAX_HEALTH = (int)game.enemyHealth;
            this.moveSpeed = game.enemyMoveSpeed;

            Console.WriteLine("ENEMY HP : " + this.MAX_HEALTH);
            Console.WriteLine("ENEMY moveSpeed : " + this.moveSpeed);

            base.translation.Translation = position;

            this.playerModel = playerModel;
            health = MAX_HEALTH;
            rng = new Random();
            randomPoint = new Vector3(rng.Next(96, 1440), 30, rng.Next(96, 1056));

            aStarPaths = new List<Vector2>();
            seekLocation = null;
        }
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     base.Draw(device, camera);
 }
Пример #6
0
        protected override void Initialize()
        {
            camera = new Camera(this, new Vector3(770, 1200, 1090), new Vector3(770, -2800, -500), Vector3.Up);
            Components.Add(camera);

            uiManager = new UIManager(this);

            audioManager = new AudioManager(this);

            score = new Score();

            // Splash screen component
            splashScreen = new SplashScreen(this);
            Components.Add(splashScreen);
            splashScreen.SetData("Welcome to Battery Derby!", currentGameState);

            modelManager = new ModelManager(this);
            modelManager.Enabled = false; // for when splash screen is enabled
            modelManager.Visible = false; // for when splash screen is enabled
            Components.Add(modelManager);

            this.IsMouseVisible = true;

            /// read in our config and behaviour files, use our xml reader helper class
            XMLReader xmlRead = new XMLReader(this);

            base.Initialize();
        }
Пример #7
0
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     device.SamplerStates[0] = SamplerState.LinearWrap;
     base.Draw(device, camera);
 }
 public MousePick(GraphicsDevice device, Camera camera)
 {
     this.device = device;
     this.camera = camera;
 }