Beispiel #1
0
 public WeaponEffect(MyModelDummy dummy, int effectId, MyWeaponDefinition.WeaponEffectAction action, MyParticleEffect effect)
 {
     this.Dummy = dummy;
     this.EffectId = effectId;
     this.Effect = effect;
     this.Action = action;
 }
Beispiel #2
0
 public WeaponEffect(MyModelDummy dummy, int effectId, MyWeaponDefinition.WeaponEffectAction action, MyParticleEffect effect)
 {
     this.Dummy    = dummy;
     this.EffectId = effectId;
     this.Effect   = effect;
     this.Action   = action;
 }
 public WeaponEffect(string name, Matrix localMatrix, int effectId, MyWeaponDefinition.WeaponEffectAction action, MyParticleEffect effect)
 {
     this.Name        = name;
     this.EffectId    = effectId;
     this.Effect      = effect;
     this.Action      = action;
     this.LocalMatrix = localMatrix;
 }
Beispiel #4
0
 public WeaponEffect(string name, Matrix localMatrix, int effectId, MyWeaponDefinition.WeaponEffectAction action, MyParticleEffect effect)
 {
     this.Name = name;
     this.EffectId = effectId;
     this.Effect = effect;
     this.Action = action;
     this.LocalMatrix = localMatrix;
 }
 public void RemoveOldEffects(MyWeaponDefinition.WeaponEffectAction action = MyWeaponDefinition.WeaponEffectAction.Shoot)
 {
     for (int i = 0; i < m_activeEffects.Count; i++)
     {
         if (m_activeEffects[i].Action == action)
         {
             m_activeEffects[i].Effect.Stop();
             m_activeEffects[i].Effect.Close(false);
             m_activeEffects.RemoveAt(i);
             i--;
         }
     }
 }
Beispiel #6
0
 public MyWeaponEffect(string action, string dummy, string particle, bool loop, bool instantStop)
 {
     this.Dummy       = dummy;
     this.Particle    = particle;
     this.Loop        = loop;
     this.InstantStop = instantStop;
     foreach (MyWeaponDefinition.WeaponEffectAction action2 in Enum.GetValues(typeof(MyWeaponDefinition.WeaponEffectAction)))
     {
         if (action2.ToString().Equals(action))
         {
             this.Action = action2;
             break;
         }
     }
 }
Beispiel #7
0
 protected void CreateEffects(MyWeaponDefinition.WeaponEffectAction action)
 {
     if (dummies != null && dummies.Count > 0 && WeaponProperties.WeaponDefinition.WeaponEffects.Length > 0)
     {
         for (int i = 0; i < WeaponProperties.WeaponDefinition.WeaponEffects.Length; i++)
         {
             if (WeaponProperties.WeaponDefinition.WeaponEffects[i].Action == action)
             {
                 MyModelDummy dummy;
                 if (dummies.TryGetValue(WeaponProperties.WeaponDefinition.WeaponEffects[i].Dummy, out dummy))
                 {
                     MyParticleEffect effect;
                     bool             add = true;
                     int effectId         = -1;
                     MyParticlesLibrary.GetParticleEffectsID(WeaponProperties.WeaponDefinition.WeaponEffects[i].Particle, out effectId);
                     if (WeaponProperties.WeaponDefinition.WeaponEffects[i].Loop)
                     {
                         for (int j = 0; j < m_activeEffects.Count; j++)
                         {
                             if (m_activeEffects[j].Dummy == dummy && m_activeEffects[j].EffectId == effectId)
                             {
                                 add = false;
                                 break;
                             }
                         }
                     }
                     if (add && MyParticlesManager.TryCreateParticleEffect(effectId, out effect))
                     {
                         if (WeaponProperties.WeaponDefinition.WeaponEffects[i].Loop)
                         {
                             m_activeEffects.Add(new WeaponEffect(dummy, effectId, action, effect));
                         }
                         else
                         {
                             effect.WorldMatrix = MatrixD.Multiply(MatrixD.Normalize(dummy.Matrix), WorldMatrix);
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #8
0
 protected void CreateEffects(MyWeaponDefinition.WeaponEffectAction action)
 {
     if (dummies != null && dummies.Count > 0 && WeaponProperties.WeaponDefinition.WeaponEffects.Length > 0)
     {
         for (int i = 0; i < WeaponProperties.WeaponDefinition.WeaponEffects.Length; i++)
         {
             if (WeaponProperties.WeaponDefinition.WeaponEffects[i].Action == action)
             {
                 MyModelDummy dummy;
                 if (dummies.TryGetValue(WeaponProperties.WeaponDefinition.WeaponEffects[i].Dummy, out dummy))
                 {
                     MyParticleEffect effect;
                     if (MyParticlesManager.TryCreateParticleEffect(WeaponProperties.WeaponDefinition.WeaponEffects[i].Particle, out effect))
                     {
                         effect.WorldMatrix = MatrixD.Multiply(MatrixD.Normalize(dummy.Matrix), WorldMatrix);
                     }
                 }
             }
         }
     }
 }