Exemple #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);
 }
 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);
 }