Пример #1
0
        /// <summary>
        /// Constructs a new projectile.
        /// </summary>
        public Projectile(ParticleSystem explosionParticles,
            ParticleSystem explosionSmokeParticles,
            ParticleSystem projectileTrailParticles)
        {
            this.explosionParticles = explosionParticles;
            this.explosionSmokeParticles = explosionSmokeParticles;

            // Start at the origin, firing in a random (but roughly upward) direction.
            position = Vector3.Zero;

            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);
        }
Пример #2
0
        public void initialize(Vector3 position, Vector3 headingDirection, float speed,
            int damage, GameObject target, BaseEnemy shooter, GameMode gameMode)
        {
            base.initialize(position, headingDirection, speed, damage, shooter);
            this.unitDirection = headingDirection; //target.Position - position;
            this.unitDirection.Normalize();
            this.forwardDir = shooter.ForwardDirection;
            this.gameMode = gameMode;
            if (gameMode == GameMode.MainGame)
            {
                this.particleManager = PlayGameScene.particleManager;
            }
            else if (gameMode == GameMode.ShipWreck)
            {
                this.particleManager = ShipWreckScene.particleManager;
            }
            else if (gameMode == GameMode.SurvivalMode)
            {
                this.particleManager = SurvivalGameScene.particleManager;
            }

            // Use the particle emitter helper to output our trail particles.
            trailEmitter = new ParticleEmitter(particleManager.projectileTrailParticles,
                                               GameConstants.trailParticlesPerSecond, position);
        }