示例#1
0
        public static byte[] GetBytes(Data.LocationAbsValues value, Data.ParentEffectType parentEffectType)
        {
            List <byte[]> data = new List <byte[]>();

            data.Add(value.Type.GetValueAsInt().GetBytes());

            if (value.Type.GetValue() == Data.LocationAbsValues.ParamaterType.Gravity)
            {
                var bytes = TranslationAbs_Gravity_Values.Create(value.Gravity).GetBytes();
                data.Add(bytes.Count().GetBytes());
                data.Add(bytes);
            }
            else if (value.Type.GetValue() == Data.LocationAbsValues.ParamaterType.AttractiveForce)
            {
                var bytes = TranslationAbs_AttractiveForce_Values.Create(value.AttractiveForce).GetBytes();
                data.Add(bytes.Count().GetBytes());
                data.Add(bytes);
            }
            else if (value.Type.GetValue() == Data.LocationAbsValues.ParamaterType.None)
            {
                data.Add(((int)0).GetBytes());
            }

            return(data.ToArray().ToArray());
        }
示例#2
0
        static public TranslationAbs_Gravity_Values Create(Data.LocationAbsValues.GravityParamater value)
        {
            var s_value = new TranslationAbs_Gravity_Values();

            s_value.Gravity = new Vector3D(
                value.Gravity.X,
                value.Gravity.Y,
                value.Gravity.Z);

            return(s_value);
        }
示例#3
0
        public static TranslationAbs_Gravity_Values Create(Data.LocationAbsValues.GravityParamater value)
        {
            var s_value = new TranslationAbs_Gravity_Values();

            s_value.Gravity = new Vector3D(
                value.Gravity.X,
                value.Gravity.Y,
                value.Gravity.Z);

            return s_value;
        }
示例#4
0
        public static byte[] GetBytes(Data.LocationAbsValues value, Data.ParentEffectType parentEffectType)
        {
            List <byte[]> data = new List <byte[]>();

            // Force field
            List <Data.LocalForceField> lffs = new List <Data.LocalForceField>
            {
                value.LocalForceField1,
                value.LocalForceField2,
                value.LocalForceField3,
            };

            data.Add((lffs.Count).GetBytes());

            foreach (var lff in lffs)
            {
                data.Add(lff.Type.GetValueAsInt().GetBytes());

                if (lff.Type.Value == Data.LocalForceFieldType.Turbulence)
                {
                    data.Add(lff.Turbulence.Seed.Value.GetBytes());
                    data.Add(lff.Turbulence.FieldScale.Value.GetBytes());
                    data.Add(lff.Turbulence.Strength.Value.GetBytes());
                    data.Add(lff.Turbulence.Octave.Value.GetBytes());
                }
            }

            data.Add(value.Type.GetValueAsInt().GetBytes());

            if (value.Type.GetValue() == Data.LocationAbsValues.ParamaterType.Gravity)
            {
                var bytes = TranslationAbs_Gravity_Values.Create(value.Gravity).GetBytes();
                data.Add(bytes.Count().GetBytes());
                data.Add(bytes);
            }
            else if (value.Type.GetValue() == Data.LocationAbsValues.ParamaterType.AttractiveForce)
            {
                var bytes = TranslationAbs_AttractiveForce_Values.Create(value.AttractiveForce).GetBytes();
                data.Add(bytes.Count().GetBytes());
                data.Add(bytes);
            }
            else if (value.Type.GetValue() == Data.LocationAbsValues.ParamaterType.None)
            {
                data.Add(((int)0).GetBytes());
            }

            return(data.ToArray().ToArray());
        }
示例#5
0
        public static byte[] GetBytes(Data.LocationAbsValues value, Data.ParentEffectType parentEffectType, ExporterVersion version)
        {
            List <byte[]> data = new List <byte[]>();

            // Force field
            List <Data.LocalForceField> lffs = new List <Data.LocalForceField>
            {
                value.LocalForceField1,
                value.LocalForceField2,
                value.LocalForceField3,
            };

            data.Add((lffs.Count).GetBytes());

            foreach (var lff in lffs)
            {
                if (version >= ExporterVersion.Ver1600)
                {
                    data.Add(lff.Type.GetValueAsInt().GetBytes());

                    var pi = (float)Math.PI;

                    data.Add(BitConverter.GetBytes(lff.Power));
                    data.Add(BitConverter.GetBytes(lff.Position.X));
                    data.Add(BitConverter.GetBytes(lff.Position.Y));
                    data.Add(BitConverter.GetBytes(lff.Position.Z));
                    data.Add(BitConverter.GetBytes(lff.Rotation.X / 180.0f * pi));
                    data.Add(BitConverter.GetBytes(lff.Rotation.Y / 180.0f * pi));
                    data.Add(BitConverter.GetBytes(lff.Rotation.Z / 180.0f * pi));

                    if (lff.Type.Value == Data.LocalForceFieldType.Force)
                    {
                        data.Add((lff.Force.Gravitation.GetValue() ? 1 : 0).GetBytes());
                    }

                    if (lff.Type.Value == Data.LocalForceFieldType.Wind)
                    {
                    }

                    if (lff.Type.Value == Data.LocalForceFieldType.Vortex)
                    {
                    }

                    if (lff.Type.Value == Data.LocalForceFieldType.Maginetic)
                    {
                    }

                    if (lff.Type.Value == Data.LocalForceFieldType.Turbulence)
                    {
                        data.Add(lff.Turbulence.Seed.Value.GetBytes());
                        data.Add(lff.Turbulence.FieldScale.Value.GetBytes());
                        data.Add(lff.Turbulence.Strength.Value.GetBytes());
                        data.Add(lff.Turbulence.Octave.Value.GetBytes());
                    }

                    if (lff.Type.Value == Data.LocalForceFieldType.Drag)
                    {
                    }

                    data.Add(lff.Falloff.Type.GetValueAsInt().GetBytes());

                    if (lff.Falloff.Type.Value != Data.ForceFieldFalloffType.None)
                    {
                        data.Add(lff.Falloff.Power.GetBytes());
                        data.Add(lff.Falloff.MaxDistance.GetBytes());
                        data.Add(lff.Falloff.MinDistance.GetBytes());

                        if (lff.Falloff.Type.Value == Data.ForceFieldFalloffType.Tube)
                        {
                            data.Add(lff.Falloff.Tube.RadiusPower.GetBytes());
                            data.Add(lff.Falloff.Tube.MaxRadius.GetBytes());
                            data.Add(lff.Falloff.Tube.MinRadius.GetBytes());
                        }

                        if (lff.Falloff.Type.Value == Data.ForceFieldFalloffType.Cone)
                        {
                            data.Add(lff.Falloff.Cone.AnglePower.GetBytes());
                            data.Add(lff.Falloff.Cone.MaxAngle.GetBytes());
                            data.Add(lff.Falloff.Cone.MinAngle.GetBytes());
                        }
                    }
                }
                else
                {
                    // 1.5 or later
                    if (lff.Type.Value == Data.LocalForceFieldType.Turbulence)
                    {
                        data.Add(lff.Type.GetValueAsInt().GetBytes());
                    }
                    else
                    {
                        data.Add(((int)(Data.LocalForceFieldType.None)).GetBytes());
                    }

                    if (lff.Type.Value == Data.LocalForceFieldType.Turbulence)
                    {
                        data.Add(lff.Turbulence.Seed.Value.GetBytes());
                        data.Add(lff.Turbulence.FieldScale.Value.GetBytes());
                        data.Add(lff.Turbulence.Strength.Value.GetBytes());
                        data.Add(lff.Turbulence.Octave.Value.GetBytes());
                    }
                }
            }

            data.Add(value.Type.GetValueAsInt().GetBytes());

            if (value.Type.GetValue() == Data.LocationAbsValues.ParamaterType.Gravity)
            {
                var bytes = TranslationAbs_Gravity_Values.Create(value.Gravity).GetBytes();
                data.Add(bytes.Count().GetBytes());
                data.Add(bytes);
            }
            else if (value.Type.GetValue() == Data.LocationAbsValues.ParamaterType.AttractiveForce)
            {
                var bytes = TranslationAbs_AttractiveForce_Values.Create(value.AttractiveForce).GetBytes();
                data.Add(bytes.Count().GetBytes());
                data.Add(bytes);
            }
            else if (value.Type.GetValue() == Data.LocationAbsValues.ParamaterType.None)
            {
                data.Add(((int)0).GetBytes());
            }

            return(data.ToArray().ToArray());
        }