コード例 #1
0
ファイル: Projectile.cs プロジェクト: nthfloor/Nebulon12
        /// <summary>
        /// Updates the projectile.
        /// </summary>
        public bool Update(GameTime gameTime, Vector3 pos, Vector3 vel, float dist, BBN_Game.Objects.StaticObject parent)
        {
            if (parent.Equals(Parent))
            {
                float elapsedTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

                // Simple projectile physics.
                //position += velocity * elapsedTime;
                //velocity.Y -= elapsedTime * gravity;
                //age += elapsedTime;

                position = pos;
                velocity = vel;

                // Update the particle emitter, which will create our particle trail.
                trailEmitter.Update(gameTime, position);

                // If enough time has passed, explode! Note how we pass our velocity
                // in to the AddParticle method: this lets the explosion be influenced
                // by the speed and direction of the projectile which created it.
                if (dist <= 0)   //age > projectileLifespan
                {
                //    for (int i = 0; i < numExplosionParticles; i++)
                //        explosionParticles.AddParticle(position, velocity);

                //    //for (int i = 0; i < numExplosionSmokeParticles; i++)
                //    //    explosionSmokeParticles.AddParticle(position, velocity);

                    return false;
                }
            }

            return true;
        }
コード例 #2
0
ファイル: Projectile.cs プロジェクト: nthfloor/Nebulon12
        /// <summary>
        /// Constructs a new projectile.
        /// </summary>
        public Projectile(ParticleSystem explosionParticles,
            ParticleSystem explosionSmokeParticles,
            ParticleSystem projectileTrailParticles, Vector3 pos, Vector3 vel, BBN_Game.Objects.StaticObject parent)
        {
            this.explosionParticles = explosionParticles;
            this.explosionSmokeParticles = explosionSmokeParticles;

            position = pos;
            velocity = vel;
            Parent = parent;

            //velocity.X = (float)(random.NextDouble() - 0.5) * sidewaysVelocityRange;
            //velocity.Y = (float)(random.NextDouble() + 0.5) * verticalVelocityRange;
            //velocity.Z = (float)(random.NextDouble() - 0.5) * sidewaysVelocityRange;

            // Use the particle emitter helper to output our trail particles.
            trailEmitter = new ParticleEmitter(projectileTrailParticles,
                                               trailParticlesPerSecond, position);
        }
コード例 #3
0
ファイル: MenuController.cs プロジェクト: nthfloor/Nebulon12
 //constructor
 public MenuController(GameController controller, BBN_Game.BBNGame g)
 {
     gameController = controller;
     this.game = g;
     graphics = g.GraphicsDevice;
     currentState = controller.CurrentGameState;
     gameController.PreviousState = currentState;
     Content = g.Content;
     screenHeight = graphics.Viewport.Height;
     screenWidth = graphics.Viewport.Width;
 }
コード例 #4
0
        //updates the list of active projectiles
        public void UpdateProjectiles(GameTime gameTime, Vector3 pos, Vector3 vel, float dist, BBN_Game.Objects.StaticObject parent)
        {
            int i = 0;

            while (i < projectiles.Count)
            {
                if (!projectiles[i].Update(gameTime,pos,vel,dist, parent))
                    projectiles.RemoveAt(i);//remove projectiles at end of their life
                else
                    i++;//advance to next projectile
            }
        }
コード例 #5
0
 //updating missile explosion effects with smoke trial
 public void MissileFiredExplosions(Vector3 position, Vector3 velocity, BBN_Game.Objects.StaticObject parent)
 {
     //create new projectile every time a missile is fired
     projectiles.Add(new Projectile(explosionParticles,
                                     explosionSmokeParticles,
                                     projectileTrailParticles, position, velocity, parent));
 }
コード例 #6
0
ファイル: playerObject.cs プロジェクト: nthfloor/Nebulon12
 public override void Draw(GameTime gameTime, BBN_Game.Camera.CameraMatrices cam)
 {
     if (this.cameraType.Equals(CurrentCam.Chase))
         base.Draw(gameTime, cam);
 }
コード例 #7
0
ファイル: GameController.cs プロジェクト: nthfloor/Nebulon12
        public GameController(BBN_Game.BBNGame game)
        {
            this.game = game;

            // Set up the Variables
            gameState = GameState.MainMenu;
            prevGameState = GameState.notLoaded;
            numPlayers = Players.single;
            ObjectsLoaded = false;
        }