/// <summary>
        /// Deklarerer komponentene
        /// </summary>
        protected override void Initialize()
        {
            camera = new Camera(this);
            this.Components.Add(camera);

            skybox = new Skybox(this, this.Content, camera);
            this.Components.Add(skybox);

            terrain = new Terrain(this, this.Content, camera);
            this.Components.Add(terrain);

            blimps = new Blimps(this, this.Content, camera, terrain);
            this.Components.Add(blimps);

            game = new Plane(this, this.Content, camera);
            this.Components.Add(game);

            explo = new ParticleComponent(this, this.Content, camera);
            this.Components.Add(explo);

            sprites = new _2Dsprites(this, this.Content, camera);
            this.Components.Add(sprites);

            spriteBatch = new SpriteBatch(graphics.GraphicsDevice);

            base.Initialize();
        }
Esempio n. 2
0
        private Vector3 z; // Vector3 som brukes til fysikken bak rotasjon av flyet

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Konstruktør
        /// </summary>
        public Plane(Game game, ContentManager content, Camera camera)
            : base(game)
        {
            graphics = (GraphicsDeviceManager)Game.Services.GetService
            (typeof(IGraphicsDeviceManager));
            this.camera = camera;
            this.content = content;
        }
 /// <summary>
 /// Konstruktøren
 /// </summary>
 public ParticleComponent(Game game, ContentManager Content, Camera camera)
     : base(game)
 {
     graphics = (GraphicsDeviceManager)Game.Services.GetService
     (typeof(IGraphicsDeviceManager));
     this.camera = camera;
     this.content = Content;
 }
Esempio n. 4
0
 /// <summary>
 /// Kontruktør som instansierer terrenget, kameraet og Contentmanager
 /// </summary>
 /// <param name="game">Spillet</param>
 /// <param name="content">Content manager</param>
 /// <param name="camera">Kameraet</param>
 public Terrain(Game game, ContentManager content, Camera camera)
     : base(game)
 {
     manager = (GraphicsDeviceManager)Game.Services.GetService
     (typeof(IGraphicsDeviceManager));
     this.camera = camera;
     this.content = content;
     terrain = content.Load<Texture2D>("Terrain/map");
 }
Esempio n. 5
0
 /// <summary>
 /// Kontruktør
 /// </summary>
 /// <param name="game">Spillet</param>
 /// <param name="Content">Content manager</param>
 /// <param name="camera">Kameraet</param>
 /// <param name="terrain">Terrenget</param>
 public Blimps(Game game, ContentManager Content, Camera camera, Terrain terrain)
     : base(game)
 {
     graphics = (GraphicsDeviceManager)Game.Services.GetService
     (typeof(IGraphicsDeviceManager));
     this.camera = camera;
     this.Content = Content;
     this.terrain = terrain;
 }
 public void Draw(Effect effect, Camera camera, Texture2D explosionTexture)
 {
     // Only draw if there are live particles
     if (endOfLiveParticlesIndex - endOfDeadParticlesIndex > 0)
     {
         // Set HLSL parameters
         effect.Parameters["xTexture"].SetValue(explosionTexture);
         effect.CurrentTechnique = effect.Techniques["ParticleExplotion"];
         effect.Parameters["WorldViewProjection"].SetValue(camera.View * camera.Projection);
         // Draw particles
         foreach (EffectPass pass in effect.CurrentTechnique.Passes)
         {
             pass.Apply();
             graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertexes, endOfDeadParticlesIndex*3, endOfLiveParticlesIndex - endOfDeadParticlesIndex, ParticleVertex.VertexDeclaration);
         }
     }
 }