Пример #1
0
        /// <summary>
        /// Loads the objects 3D model and calculates a bounding sphere for it.
        /// </summary>
        /// <param name="content">The game's content manager</param>
        /// <param name="modelName">The path of the model file</param>
        /// <param name="spaceship">The spaceship to fire at</param>
        public void LoadContent(ContentManager content, string modelName, Spaceship spaceship)
        {
            Model = content.Load<Model>(modelName);
            this.spaceship = spaceship;

            IsFiring = false;
            IsExploded = false;
        }
Пример #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()
        {
            //Initialise objects
            camera = new Camera();
            spaceship = new Spaceship();
            planet = new Planet();
            fuelCells = new FuelCell[numFuelCells];
            turrets = new Turret[numTurrets];
            readyMissiles = new List<Missile>();
            firedMissiles = new List<Missile>();
            boundingSphere = new GameObject();
            explosions = new List<Explosion>();

            //Initialise particle effect variables
            fireParticles = new FireParticleSystem(this, Content);
            fireParticles.DrawOrder = 500;
            Components.Add(fireParticles);

            explosionParticles = new ExplosionParticleSystem(this, Content);
            explosionParticles.DrawOrder = 500;
            Components.Add(explosionParticles);

            base.Initialize();
        }