Ejemplo n.º 1
0
        public Trees(Game game, ContentManager content, GraphicsDeviceManager graphics)
            : base(game)
        {
            this.content = content;
            camera = Game.Services.GetService(typeof(ChaseCamera)) as ChaseCamera;
            terrain = Game.Services.GetService(typeof(Terrain)) as Terrain;
            this.graphics = graphics;

            transformation = new Transformation();
            transformation.Scale = new Vector3(TREE_SCALE);
        }
Ejemplo n.º 2
0
        public TanksOnAHeightmapGame()
        {
            graphics = new GraphicsDeviceManager(this);
            device = GraphicsDevice;
            Content.RootDirectory = "Content";

            music = Content.Load<Song>("Sound/windbell");

            // Light Manager
            lightManager = new LightManager();
            lightManager.AmbientLightColor = new Vector3(0.2f, 0.2f, 0.2f);
            Services.AddService(typeof(LightManager), lightManager);
            // Light 1
            lightManager.Add("Light1", new PointLight(new Vector3(0, 1000.0f, 0), Vector3.One));

            //tank = new Tank(this, Content, graphics);
            terrain = new TanksOnAHeightmap.GameBase.Shapes.Terrain(this, Content, graphics);


            //InputHelper

            inputHelper = new InputHelper(PlayerIndex.One);
            Services.AddService(typeof(InputHelper), inputHelper);

            // Create the chase camera
            camera = new ChaseCamera(this);

            // Set the camera offsets
            //camera.DesiredPositionOffset = new Vector3(0.0f, 600.0f, 800.0f);//150,150
            //camera.LookAtOffset = new Vector3(0.0f, 80.0f, 0.0f);//80

            camera.DesiredPositionOffset = new Vector3(0.0f, 45.0f, 20.0f);//150,150
            camera.LookAtOffset = new Vector3(0.0f, 35.0f, -50.0f);//80

            // Set camera perspective
            camera.NearPlaneDistance = 10.0f;
            camera.FarPlaneDistance = 4000.0f;


            this.Services.AddService(typeof(TanksOnAHeightmap.GameBase.Shapes.Terrain), terrain);
            this.Services.AddService(typeof(ChaseCamera), camera);


            rand = new Random(0);

            // Construct our particle system components.
            explosionParticles = new ExplosionParticleSystem(this, Content);
            ParticleSettings settings = new ParticleSettings();


            this.Services.AddService(typeof(ExplosionParticleSystem), explosionParticles);

            explosionSmokeParticles = new ExplosionSmokeParticleSystem(this, Content);

            this.Services.AddService(typeof(ExplosionSmokeParticleSystem), explosionSmokeParticles);

            projectileTrailParticles = new ProjectileTrailParticleSystem(this, Content);

            //Trees
            trees = new Trees[NUMBER_OF_TREES];
            for (int i = 0; i < trees.Length; i++)
            {
                trees[i] = new Trees(this, Content, graphics);
                //Components.Add(trees[i]);
            }

            explosionSmokeParticles.DrawOrder = 200;
            projectileTrailParticles.DrawOrder = 300;
            explosionParticles.DrawOrder = 400;
            terrain.DrawOrder = 102;



            //Trees

            this.graphics.PreferredBackBufferWidth = 1024;
            this.graphics.PreferredBackBufferHeight = 768;

            start();



        }
Ejemplo n.º 3
0
 public static void Initialize(Game p_game,GraphicsDevice graphicsdevice)
 {
     graphicsDevice = graphicsdevice;
     game = p_game;
     camera = game.Services.GetService(typeof(ChaseCamera)) as ChaseCamera;
     InitializeGraphics();
 }
Ejemplo n.º 4
0
        public override void Initialize()
        {
            camera = Game.Services.GetService(typeof (ChaseCamera)) as ChaseCamera;
            terrain = Game.Services.GetService(typeof (Terrain)) as Terrain;
            explosionParticles = Game.Services.GetService(typeof (ExplosionParticleSystem)) as ExplosionParticleSystem;
            explosionSmokeParticles =
                Game.Services.GetService(typeof (ExplosionSmokeParticleSystem)) as ExplosionSmokeParticleSystem;

            base.Initialize();
        }