Ejemplo n.º 1
0
        void Spawn(SpawnedEffect effect)
        {
            var fx = Parent.World.Renderer.Game.GetService <GameDataManager>().GetEffect(effect.Effect);

            if (fx == null)
            {
                return;
            }
            var pfx = fx.GetEffect(Parent.World.Renderer.ResourceManager);

            if (pfx == null)
            {
                return;
            }
            foreach (var fxhp in effect.Hardpoints)
            {
                var hp    = Parent.GetHardpoint(fxhp);
                var fxobj = new AttachedEffect(hp,
                                               new ParticleEffectRenderer(pfx)
                {
                    Index = renIndex++
                });
                Parent.ExtraRenderers.Add(fxobj.Effect);
                spawned.Add(fxobj);
            }
        }
Ejemplo n.º 2
0
 public void Update(float health, double time, GameObject parent)
 {
     foreach (var fx in effects)
     {
         fx.Update(parent, time, 0);
     }
     if (health > threshold)
     {
         T        = 0;
         renIndex = 0;
         if (ran)
         {
             foreach (var child in effects)
             {
                 parent.ExtraRenderers.Remove(child.Effect);
             }
             effects.Clear();
             actions = new Queue <FuseAction>(fuse.Fuse.Actions.OrderBy(x => x.AtT));
         }
         ran = false;
     }
     else
     {
         ran = true;
         T  += time;
         FuseAction act;
         while (actions.Count > 0 && (act = actions.Peek()).AtT <= T)
         {
             actions.Dequeue();
             if (act is FuseStartEffect)
             {
                 var fxact = ((FuseStartEffect)act);
                 if (string.IsNullOrWhiteSpace(fxact.Effect))
                 {
                     continue;
                 }
                 if (!fuse.Fx.TryGetValue(fxact.Effect, out var fx))
                 {
                     continue;
                 }
                 if (fx == null)
                 {
                     continue;
                 }
                 var pfx = fx.GetEffect(parent.World.Renderer.ResourceManager);
                 if (pfx == null)
                 {
                     continue;
                 }
                 foreach (var fxhp in fxact.Hardpoints)
                 {
                     var hp    = parent.GetHardpoint(fxhp);
                     var fxobj = new AttachedEffect(hp,
                                                    new ParticleEffectRenderer(pfx)
                     {
                         Index = renIndex++
                     });
                     parent.ExtraRenderers.Add(fxobj.Effect);
                     effects.Add(fxobj);
                 }
             }
         }
     }
 }