public override void Unregister(Physics.PhysicsWorld physics)
 {
     for (int i = 0; i < fireFx.Count; i++)
     {
         Parent.ExtraRenderers.Remove(fireFx[i].Effect);
     }
 }
 public override void Register(Physics.PhysicsWorld physics)
 {
     for (int i = 0; i < fireFx.Count; i++)
     {
         Parent.ForceRenderCheck.Add(fireFx[i].Effect);
     }
 }
Exemple #3
0
 public override void Unregister(Physics.PhysicsWorld physics)
 {
     for (int i = 0; i < fireFx.Count; i++)
     {
         Parent.ForceRenderCheck.Remove(fireFx[i].Effect);
     }
     rumble.Kill();
     character.Kill();
 }
 public override void Unregister(Physics.PhysicsWorld physics)
 {
     for (int i = 0; i < fireFx.Count; i++)
     {
         Parent.ExtraRenderers.Remove(fireFx[i].Effect);
     }
     rumble?.Kill();
     character?.Kill();
     cruiseLoop?.Kill();
 }
        public override void Register(Physics.PhysicsWorld physics)
        {
            GameDataManager gameData;

            if ((gameData = GetGameData()) != null)
            {
                var resman = GetResourceManager();
                var hps    = parent.GetHardpoints();
                var fx     = gameData.GetEffect(Engine.Def.FlameEffect).GetEffect(resman);

                foreach (var hp in hps)
                {
                    if (!hp.Name.Equals("hpengineglow", StringComparison.OrdinalIgnoreCase) &&
                        hp.Name.StartsWith("hpengine", StringComparison.OrdinalIgnoreCase))
                    {
                        fireFx.Add(new AttachedEffect(hp, new ParticleEffectRenderer(fx)));
                    }
                }

                for (int i = 0; i < fireFx.Count; i++)
                {
                    Parent.ForceRenderCheck.Add(fireFx[i].Effect);
                }
            }

            SoundManager sound;

            if ((sound = GetSoundManager()) != null)
            {
                rumble = new AttachedSound(sound)
                {
                    Active = true, Sound = Engine.Def.RumbleSound
                };
                character = new AttachedSound(sound)
                {
                    Active = true, Sound = Engine.Def.CharacterLoopSound
                };
                cruiseLoop = new AttachedSound(sound)
                {
                    Active = false, Sound = Engine.Def.CruiseLoopSound
                };
            }
        }
        public override void Register(Physics.PhysicsWorld physics)
        {
            GameDataManager gameData;

            if ((gameData = GetGameData()) != null)
            {
                var            resman      = GetResourceManager();
                var            hps         = parent.GetHardpoints();
                ParticleEffect trailFx     = null;
                string         trailFxName = Engine.Def.TrailEffect;
                if (Parent.Tag == GameObject.ClientPlayerTag && !string.IsNullOrEmpty(Engine.Def.TrailEffectPlayer))
                {
                    trailFxName = Engine.Def.TrailEffectPlayer;
                }
                if (!string.IsNullOrEmpty(trailFxName))
                {
                    trailFx = gameData.GetEffect(trailFxName).GetEffect(resman);
                }
                ParticleEffect flameFx = null;
                if (!string.IsNullOrEmpty(Engine.Def.FlameEffect))
                {
                    flameFx = gameData.GetEffect(Engine.Def.FlameEffect).GetEffect(resman);
                }
                foreach (var hp in hps)
                {
                    if (!hp.Name.Equals("hpengineglow", StringComparison.OrdinalIgnoreCase) &&
                        hp.Name.StartsWith("hpengine", StringComparison.OrdinalIgnoreCase))
                    {
                        if (trailFx != null)
                        {
                            fireFx.Add(new AttachedEffect(hp, new ParticleEffectRenderer(trailFx)));
                        }
                        if (flameFx != null)
                        {
                            fireFx.Add(new AttachedEffect(hp, new ParticleEffectRenderer(flameFx)
                            {
                                Index = 1
                            }));
                        }
                    }
                }

                for (int i = 0; i < fireFx.Count; i++)
                {
                    Parent.ExtraRenderers.Add(fireFx[i].Effect);
                }
            }

            SoundManager sound;

            if ((sound = GetSoundManager()) != null)
            {
                if (!string.IsNullOrWhiteSpace(Engine.Def.RumbleSound))
                {
                    rumble = new AttachedSound(sound)
                    {
                        Active = true, Sound = Engine.Def.RumbleSound
                    };
                }
                if (!string.IsNullOrWhiteSpace(Engine.Def.CharacterLoopSound))
                {
                    character = new AttachedSound(sound)
                    {
                        Active = true, Sound = Engine.Def.CharacterLoopSound
                    };
                }
                if (!string.IsNullOrWhiteSpace(Engine.Def.CruiseLoopSound))
                {
                    cruiseLoop = new AttachedSound(sound)
                    {
                        Active = false, Sound = Engine.Def.CruiseLoopSound
                    };
                }
                if (!string.IsNullOrWhiteSpace(Engine.Def.CruiseStartSound))
                {
                    cruiseStart = new AttachedSound(sound)
                    {
                        Active   = false, Sound = Engine.Def.CruiseStartSound,
                        PlayOnce = true
                    };
                }
                if (!string.IsNullOrWhiteSpace(Engine.Def.CruiseStopSound))
                {
                    cruiseEnd = new AttachedSound(sound)
                    {
                        Active   = false, Sound = Engine.Def.CruiseStopSound,
                        PlayOnce = true
                    };
                }
            }
        }