コード例 #1
0
        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;
        }
コード例 #2
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;
        }
コード例 #3
0
        protected override void LoadContent()
        {
            Random rnd = new Random();

            vertexDeclaration = new VertexDeclaration(new VertexElement[]
                {
                    new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
                    new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0),
                    new VertexElement(24, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0)
                }
            );

            models.Add(new Ground(
                Game.Content.Load<Model>(@"Models/Ground/Ground")));

            models.Add(new Pickup(
                Game.Content.Load<Model>(@"Models/Battery/BatteryModel"),
                new Vector3(rnd.Next(MapBuilder.MINX, MapBuilder.MAXX), 30, rnd.Next(MapBuilder.MINY, MapBuilder.MAXY))));

            models.Add(new Pickup(
                Game.Content.Load<Model>(@"Models/Battery/BatteryModel"),
                new Vector3(rnd.Next(MapBuilder.MINX, MapBuilder.MAXX), 30, rnd.Next(MapBuilder.MINY, MapBuilder.MAXY))));

            ///
            /// Build a map using tiles
            ///
            if (!bBuiltMap) {

                mapBuilder = new MapBuilder(this.game);
                models.AddRange(mapBuilder.Render());

                bBuiltMap = true;
            }

            // need to keep hold of the players model
            playerModel = new Player(
                  Game.Content.Load<Model>(@"Models/Vehicles/PlayerCarModel"),
                  ((Game1)Game).GraphicsDevice,
                  ((Game1)Game).camera,
                  (Game1)game);
            models.Add(playerModel);

            Enemy enemy = new Enemy(
                Game.Content.Load<Model>(@"Models/Vehicles/BuggyFullHP"),
                ((Game1)Game).GraphicsDevice,
                ((Game1)Game).camera,
                new Vector3(rnd.Next(MapBuilder.MINX, MapBuilder.MAXX), 0, MapBuilder.MAXY),
                playerModel,
                (Game1)game);
            models.Add(enemy);

            /*
            MonsterTruck enemyTruck = new MonsterTruck(
                Game.Content.Load<Model>(@"Models/Vehicles/MonsterTruckFull"),
                ((Game1)Game).GraphicsDevice,
                ((Game1)Game).camera,
                new Vector3(rnd.Next(MapBuilder.MINX, MapBuilder.MAXX), 0, MapBuilder.MAXY),
                playerModel,
                uiManager);
            models.Add(enemyTruck);
            */

            base.LoadContent();
        }