コード例 #1
0
 GameData.Items.Equipment GetEquipment(Legacy.Equipment.AbstractEquipment val)
 {
     GameData.Items.Equipment equip = null;
     if (val is Legacy.Equipment.Light)
     {
         equip = GetLight((Legacy.Equipment.Light)val);
     }
     else if (val is Legacy.Equipment.InternalFx)
     {
         var eq = new GameData.Items.AnimationEquipment();
         eq.Animation = ((Legacy.Equipment.InternalFx)val).UseAnimation;
         equip        = eq;
     }
     if (val is Legacy.Equipment.AttachedFx)
     {
         equip = GetAttachedFx((Legacy.Equipment.AttachedFx)val);
     }
     if (val is Legacy.Equipment.PowerCore)
     {
         var pc = (val as Legacy.Equipment.PowerCore);
         if (pc.MaterialLibrary != null)
         {
             resource.LoadMat(ResolveDataPath(pc.MaterialLibrary));
         }
         var drawable = resource.GetDrawable(ResolveDataPath(pc.DaArchetype));
         equip = new GameData.Items.PowerEquipment()
         {
             Model = drawable
         };
     }
     if (val is Legacy.Equipment.Thruster)
     {
         var th = (val as Legacy.Equipment.Thruster);
         resource.LoadMat(ResolveDataPath(th.MaterialLibrary));
         var drawable = resource.GetDrawable(ResolveDataPath(th.DaArchetype));
         equip = new GameData.Items.ThrusterEquipment()
         {
             Drain       = th.PowerUsage,
             Force       = th.MaxForce,
             Model       = drawable,
             HpParticles = th.HpParticles,
             Particles   = GetEffect(th.Particles)
         };
     }
     return(equip);
 }
コード例 #2
0
 GameData.Items.Equipment GetEquipment(Data.Equipment.AbstractEquipment val)
 {
     GameData.Items.Equipment equip = null;
     if (val is Data.Equipment.Light)
     {
         equip = GetLight((Data.Equipment.Light)val);
     }
     else if (val is Data.Equipment.InternalFx)
     {
         var eq = new GameData.Items.AnimationEquipment();
         eq.Animation = ((Data.Equipment.InternalFx)val).UseAnimation;
         equip        = eq;
     }
     if (val is Data.Equipment.AttachedFx)
     {
         equip = GetAttachedFx((Data.Equipment.AttachedFx)val);
     }
     if (val is Data.Equipment.PowerCore)
     {
         var pc = (val as Data.Equipment.PowerCore);
         if (pc.MaterialLibrary != null)
         {
             resource.LoadResourceFile(ResolveDataPath(pc.MaterialLibrary));
         }
         var drawable = resource.GetDrawable(ResolveDataPath(pc.DaArchetype));
         equip = new GameData.Items.PowerEquipment()
         {
             Model = drawable
         };
     }
     if (val is Data.Equipment.Gun)
     {
         var gn = (val as Data.Equipment.Gun);
         if (gn.MaterialLibrary != null)
         {
             resource.LoadResourceFile(ResolveDataPath(gn.MaterialLibrary));
         }
         var    drawable = resource.GetDrawable(ResolveDataPath(gn.DaArchetype));
         var    mn       = fldata.Equipment.Munitions.FirstOrDefault((x) => x.Nickname.Equals(gn.ProjectileArchetype, StringComparison.OrdinalIgnoreCase));
         var    effect   = fldata.Effects.FindEffect(mn.ConstEffect);
         string visbeam;
         if (effect == null)
         {
             visbeam = "";
         }
         else
         {
             visbeam = effect.VisBeam ?? "";
         }
         var mequip = new GameData.Items.MunitionEquip()
         {
             Def = mn,
             ConstEffect_Beam = fldata.Effects.BeamSpears.FirstOrDefault((x) => x.Nickname.Equals(visbeam, StringComparison.OrdinalIgnoreCase)),
             ConstEffect_Bolt = fldata.Effects.BeamBolts.FirstOrDefault((x) => x.Nickname.Equals(visbeam, StringComparison.OrdinalIgnoreCase))
         };
         equip = new GameData.Items.GunEquipment()
         {
             Model    = drawable,
             Munition = mequip,
             Def      = gn
         };
     }
     if (val is Data.Equipment.Thruster)
     {
         var th = (val as Data.Equipment.Thruster);
         resource.LoadResourceFile(ResolveDataPath(th.MaterialLibrary));
         var drawable = resource.GetDrawable(ResolveDataPath(th.DaArchetype));
         equip = new GameData.Items.ThrusterEquipment()
         {
             Drain       = th.PowerUsage,
             Force       = th.MaxForce,
             Model       = drawable,
             HpParticles = th.HpParticles,
             Particles   = GetEffect(th.Particles)
         };
     }
     equip.Nickname  = val.Nickname;
     equip.HPChild   = val.HPChild;
     equip.LODRanges = val.LODRanges;
     return(equip);
 }
コード例 #3
0
ファイル: LegacyGameData.cs プロジェクト: gp-alex/Librelancer
 GameData.Items.Equipment GetEquipment(Legacy.Equipment.AbstractEquipment val)
 {
     GameData.Items.Equipment equip = null;
     if (val is Legacy.Equipment.Light)
     {
         equip = GetLight((Legacy.Equipment.Light)val);
     }
     else if (val is Legacy.Equipment.InternalFx)
     {
         var eq = new GameData.Items.AnimationEquipment();
         eq.Animation = ((Legacy.Equipment.InternalFx)val).UseAnimation;
         equip        = eq;
     }
     if (val is Legacy.Equipment.AttachedFx)
     {
         equip = GetAttachedFx((Legacy.Equipment.AttachedFx)val);
     }
     if (val is Legacy.Equipment.PowerCore)
     {
         var pc = (val as Legacy.Equipment.PowerCore);
         if (pc.MaterialLibrary != null)
         {
             resource.LoadResourceFile(ResolveDataPath(pc.MaterialLibrary));
         }
         var drawable = resource.GetDrawable(ResolveDataPath(pc.DaArchetype));
         equip = new GameData.Items.PowerEquipment()
         {
             Model = drawable
         };
     }
     if (val is Legacy.Equipment.Gun)
     {
         var gn = (val as Legacy.Equipment.Gun);
         if (gn.MaterialLibrary != null)
         {
             resource.LoadResourceFile(ResolveDataPath(gn.MaterialLibrary));
         }
         var drawable = resource.GetDrawable(ResolveDataPath(gn.DaArchetype));
         equip = new GameData.Items.GunEquipment()
         {
             Model           = drawable,
             TurnRateRadians = MathHelper.DegreesToRadians(gn.TurnRate)
         };
     }
     if (val is Legacy.Equipment.Thruster)
     {
         var th = (val as Legacy.Equipment.Thruster);
         resource.LoadResourceFile(ResolveDataPath(th.MaterialLibrary));
         var drawable = resource.GetDrawable(ResolveDataPath(th.DaArchetype));
         equip = new GameData.Items.ThrusterEquipment()
         {
             Drain       = th.PowerUsage,
             Force       = th.MaxForce,
             Model       = drawable,
             HpParticles = th.HpParticles,
             Particles   = GetEffect(th.Particles)
         };
     }
     equip.Nickname  = val.Nickname;
     equip.HPChild   = val.HPChild;
     equip.LODRanges = val.LODRanges;
     return(equip);
 }