Пример #1
0
 public PlayerFootStepR( SfxSystem sfxSystem, FXEvent fxEvent )
     : base(sfxSystem, fxEvent)
 {
     ShakeCamera(0,0,15);
     var name = "foot" + rand.Next(0,6);
     AddSoundStage( @"sound\character\" + name,	fxEvent.Origin, 4, false );
 }
Пример #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sfxSystem"></param>
 /// <param name="fxEvent"></param>
 public SfxInstance( SfxSystem sfxSystem, FXEvent fxEvent )
 {
     this.sfxSystem	=	sfxSystem;
     this.rw			=	sfxSystem.rw;
     this.sw			=	sfxSystem.sw;
     this.fxEvent	=	fxEvent;
 }
Пример #3
0
        void EmitBlood( ref Particle p, FXEvent fxEvent )
        {
            //var m   =	Matrix.RotationQuaternion( fxEvent.Rotation );
            //var vel	=	-m.Forward * rand.GaussDistribution(3,1) + rand.GaussRadialDistribution(0, 1.0f);
            //var pos	=	fxEvent.Origin;

            //SetupMotion		( ref p, pos, vel, Vector3.Zero, 0, 0.7f );
            //SetupAngles		( ref p, 10 );
            //SetupColor		( ref p, 10, 10, 1, 1 );
            //SetupTiming		( ref p, 0.5f, 0.01f, 0.9f );
            //SetupSize		( ref p, 0.3f, 0.00f );

            var m   =	Matrix.RotationQuaternion( fxEvent.Rotation );
            var dir =	rand.UniformRadialDistribution(0.1f,0.1f) + fxEvent.Velocity;
            var vel	=	Vector3.Up * 3 + rand.GaussRadialDistribution(0.5f,0.5f) + fxEvent.Velocity * rand.NextFloat(0,0.1f);
            var pos	=	fxEvent.Origin;

            var time = rand.NextFloat(0.7f, 1.3f);

            SetupMotion		( ref p, pos, vel, Vector3.Zero, 0, 0.8f );
            SetupAngles		( ref p, 50 );
            SetupColor		( ref p, 20, 20, 0, 1 );
            SetupTiming		( ref p, time, 0.01f, 0.1f );
            SetupSize		( ref p, 0.5f, 0.7f );
        }
Пример #4
0
        public PlayerLanding( SfxSystem sfxSystem, FXEvent fxEvent )
            : base(sfxSystem, fxEvent)
        {
            float fallSpeed = Math.Abs(fxEvent.Velocity.Y);
            ShakeCamera(0, -30 * fallSpeed, rand.GaussDistribution(0, 10*fallSpeed));

            AddSoundStage( @"sound\character\fall0", fxEvent.Origin, 4, false );
        }
Пример #5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="game"></param>
        public SfxView( Entity entity, World world, string sfxName )
            : base(entity, world)
        {
            var fxID	=	World.GameClient.Atoms[ sfxName ];
            var	fxEvent	=	new FXEvent(fxID, entity.ID, entity.Position, entity.LinearVelocity, entity.Rotation);

            sfx = World.RunFX( fxEvent );
        }
Пример #6
0
        public Mist( SfxSystem sfxSystem, FXEvent fxEvent )
            : base(sfxSystem, fxEvent)
        {
            sparkDir = Matrix.RotationQuaternion(fxEvent.Rotation).Forward;

            AddParticleStage("railDot", 0, 0f, 0.1f,   100, true, EmitSpark );
            AddParticleStage("smoke"  , 0, 0f, 0.1f,   200, true, EmitPuff );

            AddLightStage( fxEvent.Origin + sparkDir * 0.1f	, GetRailColor(0.03f), 10.0f, 100f, 3f );
        }
Пример #7
0
        public RocketTrail( SfxSystem sfxSystem, FXEvent fxEvent )
            : base(sfxSystem, fxEvent)
        {
            //AddParticleStage("bulletSpark",		0.00f, 0.1f, 0.0f,  150, true, EmitSpark );
            AddParticleStage("explosionFire",	0.00f, 0.2f, 0.0f,   90, true, EmitFire );
            AddParticleStage("smoke",	0.00f, 0.2f, 0.0f,   60, true, EmitSmoke );

            AddLightStage( fxEvent.Origin * 0.1f	, new Color4(100, 75, 50,1), 1, 100f, 3f );

            AddSoundStage( @"sound\weapon\rfly",	fxEvent.Origin, 1, true );
        }
Пример #8
0
        void EmitSpark( ref Particle p, FXEvent fxEvent )
        {
            var vel	=	rand.GaussRadialDistribution(0, 6.0f) + sparkDir * 2;
            var pos	=	fxEvent.Origin + rand.UniformRadialDistribution(1,1) * 0.3f;

            SetupMotion		( ref p, pos, vel, -vel );
            SetupAngles		( ref p, 160 );
            SetupColor		( ref p, 500, 500, 0, 1 );
            SetupTiming		( ref p, 0.2f, 0.01f, 0.9f );
            SetupSize		( ref p, 0.2f, 0.00f );
        }
Пример #9
0
        //void EmitSpark ( ref Particle p, FXEvent fxEvent )
        //{
        //    var vel	=	rand.GaussRadialDistribution(0, 6.0f);
        //    var pos	=	fxEvent.Origin;
        //    SetupMotion		( ref p, pos, Vector3.Zero, Vector3.Zero );
        //    SetupAngles		( ref p, 160 );
        //    SetupColor		( ref p, 500, 0, 1 );
        //    SetupTiming		( ref p, 0.2f, 0.01f, 0.9f );
        //    SetupSize		( ref p, 0.1f, 0.00f );
        //}
        void EmitFire( ref Particle p, FXEvent fxEvent )
        {
            var vel	=	rand.GaussRadialDistribution(0, 0.3f) + Matrix.RotationQuaternion(fxEvent.Rotation).Backward * 5;
            var pos	=	fxEvent.Origin;

            SetupMotion		( ref p, pos, vel, Vector3.Zero );
            SetupAngles		( ref p, 0 );
            SetupColor		( ref p, 500, 500, 0, 1.0f );
            SetupTiming		( ref p, 0.10f, 0.01f, 0.1f );
            SetupSize		( ref p, 0.15f, 0.3f );
        }
Пример #10
0
        public PlasmaTrail( SfxSystem sfxSystem, FXEvent fxEvent )
            : base(sfxSystem, fxEvent)
        {
            //AddParticleStage("bulletSpark",		0.00f, 0.1f, 0.0f,  150, true, EmitSpark );
            AddParticleStage("plasmaCore",	0.00f, 0.2f, 0.0f,   30, true, EmitFire );
            //AddParticleStage("smoke",	0.00f, 0.2f, 0.0f,   60, true, EmitSmoke );

            AddLightStage( fxEvent.Origin * 0.1f	, new Color4(195, 195, 250,1), 2, 100f, 3f );

            AddSoundStage( @"sound\weapon\rfly",	fxEvent.Origin, 1, true );
        }
Пример #11
0
        void EmitSpark( ref Particle p, FXEvent fxEvent )
        {
            var vel	=	sparkDir * rand.GaussDistribution(4,3) + rand.GaussRadialDistribution(0, 0.7f);
            var pos	=	fxEvent.Origin;

            SetupMotion		( ref p, pos, vel, Vector3.Zero, 0, 1 );
            SetupAngles		( ref p, 160 );
            SetupColor		( ref p, 500, 500, 0, 1 );
            SetupTiming		( ref p, 0.5f, 0.01f, 0.9f );
            SetupSize		( ref p, 0.1f, 0.00f );
        }
Пример #12
0
        public ShotTrail( SfxSystem sfxSystem, FXEvent fxEvent )
            : base(sfxSystem, fxEvent)
        {
            sparkDir = Matrix.RotationQuaternion(fxEvent.Rotation).Forward + rand.GaussRadialDistribution(0, 0.1f);
            sparkDir.Normalize();

            AddParticleStage("bulletSpark", 0, 0f, 0.1f, 10, false, EmitSpark );

            AddLightStage( fxEvent.Origin + sparkDir * 0.1f	, new Color4(125,110, 35,1), 0.5f, 100f, 3f );

            //AddSoundStage( @"sound\weapon\bulletHit",	fxEvent.Origin, 1, false );
        }
Пример #13
0
        void EmitSmoke( ref Particle p, FXEvent fxEvent )
        {
            var dir = 	rand.UniformRadialDistribution(0,0.2f);
            var vel	=	dir * 0.5f;
            var pos	=	fxEvent.Origin;

            SetupMotion		( ref p, pos, vel, Vector3.Zero, 0, -0.05f );
            SetupAngles		( ref p, 10 );
            SetupColor		( ref p, 5, 5, 0, 1.0f );
            SetupTiming		( ref p, 1.5f, 0.1f, 0.1f );
            SetupSize		( ref p, 0.15f, 0.5f );
        }
Пример #14
0
        public RailHit( SfxSystem sfxSystem, FXEvent fxEvent )
            : base(sfxSystem, fxEvent)
        {
            sparkDir = Matrix.RotationQuaternion(fxEvent.Rotation).Forward;

            AddParticleStage("railDot", 0, 0f, 0.1f, 100, false, EmitSpark );
            //AddParticleStage("railDot", 0, 0f, 0.1f,  30, false, EmitPuff );

            AddLightStage( fxEvent.Origin + sparkDir * 0.1f	, GetRailColor(0.03f), 1.0f, 100f, 3f );

            AddSoundStage( @"sound\weapon\railshot",	fxEvent.Origin, 1, false );
        }
Пример #15
0
        void EmitFire( ref Particle p, FXEvent fxEvent )
        {
            var vel	=	rand.UniformRadialDistribution(0, 0.5f);
            var pos	=	fxEvent.Origin + rand.UniformRadialDistribution(1,1) * 0.1f;

            float time	=	rand.NextFloat(0.1f, 0.3f);

            SetupMotion		( ref p, pos, vel, Vector3.Zero );
            SetupAngles		( ref p, 1 );
            SetupColor		( ref p, 1000, 1000, 0, 1.0f );
            SetupTiming		( ref p, time, 0.01f, 0.1f );
            SetupSize		( ref p, 0.3f, 0.7f );
        }
Пример #16
0
        void EmitPuff( ref Particle p, FXEvent fxEvent )
        {
            var vel	=	rand.GaussRadialDistribution(0, 1.5f);
            var pos	=	fxEvent.Origin;

            SetupMotion		( ref p, pos, vel, vel, 0, 0.0f );
            SetupAngles		( ref p, 10 );
            SetupTiming		( ref p, 1f, 0.01f, 0.1f );
            SetupSize		( ref p, 0.2f, 0.0f );

            p.Color0		=	GetRailColor();
            p.Color1		=	GetRailColor();
        }
Пример #17
0
        public Explosion( SfxSystem sfxSystem, FXEvent fxEvent )
            : base(sfxSystem, fxEvent)
        {
            sparkDir = Matrix.RotationQuaternion(fxEvent.Rotation).Forward;

            AddParticleStage("bulletSpark",		0.00f, 0.0f, 0.1f,  150, false, EmitSpark );
            AddParticleStage("explosionSmoke",	0.10f, 0.1f, 1.0f,  15*3, false, EmitSmoke );
            AddParticleStage("explosionSmoke2",	0.10f, 0.1f, 1.0f,  15*3, false, EmitSmoke );
            AddParticleStage("explosionFire",	0.00f, 0.1f, 1.0f,  30*2, false, EmitFire );

            AddLightStage( fxEvent.Origin + sparkDir * 0.1f	, new Color4(200,150,100,1), 3, 100f, 3f );

            AddSoundStage( @"sound\weapon\explosion",	fxEvent.Origin, 1, false );
        }
Пример #18
0
        void EmitBall( ref Particle p, FXEvent fxEvent )
        {
            var dir = 	rand.UniformRadialDistribution(0,1);
            var vel	=	Vector3.Zero;
            var pos	=	fxEvent.Origin;

            float time	=	rand.NextFloat(0.05f, 0.10f);

            SetupMotion		( ref p, pos, Vector3.Zero, Vector3.Zero );
            SetupAngles		( ref p, 100 );
            SetupColor		( ref p, 1000, 1000, 0, 1.0f );
            SetupTiming		( ref p, time, 0.1f, 0.2f );
            SetupSize		( ref p, 0.2f, 0.5f );
        }
Пример #19
0
        public GenericPain( SfxSystem sfxSystem, FXEvent fxEvent, string sound, float shake, int bloodAmount, int gibAmount=0 )
            : base(sfxSystem, fxEvent)
        {
            ShakeCamera( rand.GaussDistribution(0,shake), rand.GaussDistribution(0,shake), rand.GaussDistribution(0,shake) );

            AddParticleStage("bloodSpray04", 0, 0f, 0.1f, bloodAmount, false, EmitBlood );
            AddParticleStage("bloodSpray04", 0, 0f, 0.1f, gibAmount,   false, EmitGib );

            if (sfxSystem.world.IsPlayer(fxEvent.ParentID)) {
                AddSoundStage( sound,	false );
            } else {
                AddSoundStage( sound, fxEvent.Origin, 1, false );
            }
        }
Пример #20
0
        public PlasmaExplosion( SfxSystem sfxSystem, FXEvent fxEvent )
            : base(sfxSystem, fxEvent)
        {
            sparkDir = Matrix.RotationQuaternion(fxEvent.Rotation).Forward;

            AddParticleStage("plasmaCore",		0.00f, 0.0f, 0.1f,  50, false, EmitSpark );
            AddParticleStage("plasmaCore",		0.00f, 0.1f, 1.0f,   5, false, EmitBall );
            //AddParticleStage("plasmaPuff",	0.10f, 0.1f, 1.0f,   15, false, EmitSmoke );
            AddParticleStage("plasmaFire",	0.05f, 0.1f, 1.0f,   15, false, EmitFire );

            AddLightStage( fxEvent.Origin - sparkDir * 0.1f	, new Color4(195, 195, 250,1), 2, 100f, 3f );

            AddSoundStage( @"sound\weapon\plasmaHit",	fxEvent.Origin, 1, false );
        }
Пример #21
0
        void EmitSpark( ref Particle p, FXEvent fxEvent )
        {
            var vel		=	rand.GaussRadialDistribution(0, 1f)*2 + Vector3.Up;
            var accel	=	-vel*1 + rand.GaussRadialDistribution(0, 1.2f);
            var pos		=	fxEvent.Origin + Vector3.Up * rand.GaussDistribution(1,0.5f);
            var time	=	rand.GaussDistribution(1.0f,0.2f);

            SetupMotion		( ref p, pos, vel, accel, 0, 0 );
            SetupAngles		( ref p, 160 );
            SetupTiming		( ref p, time, 0.01f, 0.9f );
            SetupSize		( ref p, 0.25f, 0.00f );

            p.Color0		=	GetRailColor();
            p.Color1		=	GetRailColor();
        }
Пример #22
0
        public TeleportOut( SfxSystem sfxSystem, FXEvent fxEvent )
            : base(sfxSystem, fxEvent)
        {
            sparkDir = Matrix.RotationQuaternion(fxEvent.Rotation).Forward;

            AddParticleStage("teleportSpark", 0, 0f, 0.1f, 150, false, EmitSpark );

            AddLightStage( fxEvent.Origin + sparkDir * 0.1f	, GetRailColor(0.03f), 1.0f, 100f, 3f );

            if (sfxSystem.world.IsPlayer(fxEvent.ParentID)) {
                AddSoundStage( @"sound\misc\teleport",	false );
            } else {
                AddSoundStage( @"sound\misc\teleport", fxEvent.Origin, 1, false );
            }
        }
Пример #23
0
        void EmitSpark( ref Particle p, FXEvent fxEvent )
        {
            var vel		=	(sparkDir * rand.GaussDistribution(1,1) + rand.GaussRadialDistribution(0, 1f))*0.7f;
            var accel	=	-vel*2 + rand.GaussRadialDistribution(0, 1.2f);
            var pos		=	fxEvent.Origin;
            var time	=	rand.GaussDistribution(1,0.2f);

            SetupMotion		( ref p, pos, vel, accel, 0, 0 );
            SetupAngles		( ref p, 160 );
            SetupTiming		( ref p, time, 0.01f, 0.9f );
            SetupSize		( ref p, 0.1f, 0.00f );

            p.Color0		=	GetRailColor();
            p.Color1		=	GetRailColor();
        }
Пример #24
0
        void EmitSpark( ref Particle p, FXEvent fxEvent )
        {
            var vel		=	rand.GaussRadialDistribution(0, 0.03f);
            var accel	=	rand.GaussRadialDistribution(0, 0.03f);
            var pos		=	fxEvent.Origin + rand.NextVector3( new Vector3(-20,-5,-20), new Vector3(20,0,20) );
            var time	=	rand.GaussDistribution(3,0.5f);

            SetupMotion		( ref p, pos, vel, accel, 0, 0 );
            SetupAngles		( ref p, 5 );
            SetupTiming		( ref p, time, 0.2f, 0.8f );
            SetupSize		( ref p, 0.1f, 0.00f );

            p.Color0		=	new Color4(0.0f, 0.0f, 0.0f, 0.0f);
            p.Color1		=	new Color4(0.7f, 0.7f, 0.7f, 0.7f);
            p.Effects		=	ParticleFX.Lit;
        }
Пример #25
0
        void EmitPuff( ref Particle p, FXEvent fxEvent )
        {
            var vel		=	Vector3.Zero;
            var accel	=	Vector3.Zero;
            var pos		=	fxEvent.Origin + rand.NextVector3( new Vector3(-24,-5,-24), new Vector3(24,-2,24) );
            var time	=	rand.GaussDistribution(10,0.5f);

            SetupMotion		( ref p, pos, vel, accel, 0, 0 );
            SetupAngles		( ref p, 30 );
            SetupTiming		( ref p, time, 0.2f, 0.2f );
            SetupSize		( ref p, 2.5f, 2.5f );

            p.Color0		=	new Color4(0.0f, 0.0f, 0.0f, 0.0f);
            p.Color1		=	new Color4(0.2f, 0.2f, 0.2f, 0.2f);
            p.Effects		=	ParticleFX.LitShadow;
        }
Пример #26
0
        void EmitSmoke( ref Particle p, FXEvent fxEvent )
        {
            var dir = 	rand.UniformRadialDistribution(0,1);
            var vel	=	dir * 0.5f;
            var pos	=	fxEvent.Origin + dir;

            float time	=	rand.NextFloat(1.4f, 1.6f);

            SetupMotion		( ref p, pos, vel, -vel*1.5f );
            SetupAngles		( ref p, 10 );
            SetupColor		( ref p, 0.1f, 0.1f, 0, 0.7f );
            SetupTiming		( ref p, time, 0.1f, 0.2f );
            SetupSize		( ref p, 1.2f, 1.2f );

            p.Effects	=	ParticleFX.LitShadow;
        }
Пример #27
0
        public MZBlaster( SfxSystem sfxSystem, FXEvent fxEvent )
            : base(sfxSystem, fxEvent)
        {
            ShakeCamera( rand.GaussDistribution(0,5), rand.GaussDistribution(5,5), rand.GaussDistribution(0,5) );

            sparkDir = Matrix.RotationQuaternion(fxEvent.Rotation).Forward;
            //AddParticleStage("bulletSpark", 0, 0f, 0.1f, 30, EmitSpark );

            AddLightStage( fxEvent.Origin + sparkDir * 0.1f	, new Color4(137,137,228,1), 1, 100f, 3f );

            if (sfxSystem.world.IsPlayer(fxEvent.ParentID)) {
                AddSoundStage( @"sound\weapon\plasma",	false );
            } else {
                AddSoundStage( @"sound\weapon\plasma", fxEvent.Origin, 1, false );
            }
        }
Пример #28
0
        void EmitSpark( ref Particle p, FXEvent fxEvent )
        {
            //var vel		=	(sparkDir * rand.GaussDistribution(1,1) + rand.GaussRadialDistribution(0, 1f))*0.7f;
            //var accel	=	-vel*2 + rand.GaussRadialDistribution(0, 1.2f);
            //var pos		=	fxEvent.Origin;
            //var time	=	rand.GaussDistribution(1,0.2f);

            //SetupMotion		( ref p, pos, vel, accel, 0, 0 );
            //SetupAngles		( ref p, 160 );
            //SetupTiming		( ref p, time, 0.01f, 0.9f );
            //SetupSize		( ref p, 0.1f, 0.00f );
            //SetupColor		( ref p, 500, 500, 0, 1 );

            var vel		=	rand.GaussRadialDistribution(0, 3.0f) + sparkDir * 2;
            var pos		=	fxEvent.Origin;// + rand.UniformRadialDistribution(1,1) * 0.0f;
            var accel	=	-vel*2 + rand.GaussRadialDistribution(0, 1.2f);

            SetupMotion		( ref p, pos, vel, accel );
            SetupAngles		( ref p, 160 );
            SetupColor		( ref p, 1000, 1000, 0, 1 );
            SetupTiming		( ref p, 0.2f, 0.01f, 0.9f );
            SetupSize		( ref p, 0.15f, 0.00f );
        }
Пример #29
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="fxEvent"></param>
        public SfxInstance RunFX( FXEvent fxEvent )
        {
            var fxAtomID	=	fxEvent.FXAtomID;

            if (fxAtomID<0) {
                Log.Warning("RunFX: negative atom ID");
                return null;
            }

            var className = client.Atoms[ fxAtomID ];

            if (className==null) {
                Log.Warning("RunFX: bad atom ID");
                return null;
            }

            Type fxType;

            if (sfxDict.TryGetValue( className, out fxType )) {

                var sfx = (SfxInstance)Activator.CreateInstance( fxType, this, fxEvent );
                runningSFXes.Add( sfx );

                return sfx;

            } else {
                Log.Warning("RunFX: Bad FX type name: {0}", className );
                return null;
            }
        }
Пример #30
0
 /// <summary>
 /// Updates internal stage state.
 /// </summary>
 /// <param name="dt"></param>
 public abstract void Update( float dt, FXEvent fxEvent );