Exemple #1
0
        public ProjectileData GetData(GameData.Items.GunEquipment gunDef)
        {
            ProjectileData pdata;

            if (datas.TryGetValue(gunDef.Nickname, out pdata))
            {
                return(pdata);
            }
            pdata          = new ProjectileData();
            pdata.Munition = gunDef.Munition;
            pdata.Lifetime = gunDef.Munition.Def.Lifetime;
            pdata.Velocity = gunDef.Def.MuzzleVelocity;
            if (world.Renderer != null)
            {
                var res = world.Renderer.Game.GetService <GameDataManager>();
                if (gunDef.Munition.Def.MunitionHitEffect != null)
                {
                    pdata.HitEffect = res.GetEffect(gunDef.Munition.Def.MunitionHitEffect)
                                      .GetEffect(world.Renderer.ResourceManager);
                }
                if (gunDef.Munition.Def.ConstEffect != null)
                {
                    pdata.TravelEffect = res.GetEffect(gunDef.Munition.Def.ConstEffect)?
                                         .GetEffect(world.Renderer.ResourceManager);
                }
            }
            datas.Add(gunDef.Nickname, pdata);
            return(pdata);
        }
Exemple #2
0
 public void QueueProjectile(int owner, GameData.Items.GunEquipment gunDef, uint hardpoint, Vector3 position, Vector3 heading)
 {
     queued.Add(new ProjectileSpawn()
     {
         Owner = owner, Gun = gunDef.CRC, Hardpoint = hardpoint, Heading = heading, Start = position
     });
 }
        public ProjectileData GetData(GameData.Items.GunEquipment gunDef)
        {
            ProjectileData pdata;

            if (datas.TryGetValue(gunDef.Nickname, out pdata))
            {
                return(pdata);
            }
            pdata          = new ProjectileData();
            pdata.Munition = gunDef.Munition;
            pdata.Lifetime = gunDef.Munition.Def.Lifetime;
            pdata.Velocity = gunDef.Def.MuzzleVelocity;
            datas.Add(gunDef.Nickname, pdata);
            return(pdata);
        }
 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);
 }
 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);
 }