コード例 #1
0
        public void InitializeSplineData(MoveSpline moveSpline)
        {
            SplineData.Id = moveSpline.GetId();
            MovementSpline movementSpline = SplineData.Move;

            MoveSplineFlag splineFlags = moveSpline.splineflags;

            splineFlags.SetUnsetFlag(SplineFlag.Cyclic, moveSpline.IsCyclic());
            movementSpline.Flags         = (uint)(splineFlags.Flags & ~SplineFlag.MaskNoMonsterMove);
            movementSpline.Face          = moveSpline.facing.type;
            movementSpline.FaceDirection = moveSpline.facing.angle;
            movementSpline.FaceGUID      = moveSpline.facing.target;
            movementSpline.FaceSpot      = moveSpline.facing.f;

            if (splineFlags.HasFlag(SplineFlag.Animation))
            {
                movementSpline.AnimTier           = splineFlags.GetAnimTier();
                movementSpline.TierTransStartTime = (uint)moveSpline.effect_start_time;
            }

            movementSpline.MoveTime = (uint)moveSpline.Duration();

            if (splineFlags.HasFlag(SplineFlag.Parabolic))
            {
                movementSpline.JumpExtraData.HasValue          = true;
                movementSpline.JumpExtraData.Value.JumpGravity = moveSpline.vertical_acceleration;
                movementSpline.JumpExtraData.Value.StartTime   = (uint)moveSpline.effect_start_time;
            }

            if (splineFlags.HasFlag(SplineFlag.FadeObject))
            {
                movementSpline.FadeObjectTime = (uint)moveSpline.effect_start_time;
            }

            if (moveSpline.spell_effect_extra.HasValue)
            {
                movementSpline.SpellEffectExtraData.HasValue               = true;
                movementSpline.SpellEffectExtraData.Value.TargetGuid       = moveSpline.spell_effect_extra.Value.Target;
                movementSpline.SpellEffectExtraData.Value.SpellVisualID    = moveSpline.spell_effect_extra.Value.SpellVisualId;
                movementSpline.SpellEffectExtraData.Value.ProgressCurveID  = moveSpline.spell_effect_extra.Value.ProgressCurveId;
                movementSpline.SpellEffectExtraData.Value.ParabolicCurveID = moveSpline.spell_effect_extra.Value.ParabolicCurveId;
                movementSpline.SpellEffectExtraData.Value.JumpGravity      = moveSpline.vertical_acceleration;
            }

            Spline spline = moveSpline.spline;

            Vector3[] array = spline.GetPoints();

            if (splineFlags.HasFlag(SplineFlag.UncompressedPath))
            {
                if (!splineFlags.HasFlag(SplineFlag.Cyclic))
                {
                    int count = spline.GetPointCount() - 3;
                    for (uint i = 0; i < count; ++i)
                    {
                        movementSpline.Points.Add(array[i + 2]);
                    }
                }
                else
                {
                    int count = spline.GetPointCount() - 3;
                    movementSpline.Points.Add(array[1]);
                    for (uint i = 0; i < count; ++i)
                    {
                        movementSpline.Points.Add(array[i + 1]);
                    }
                }
            }
            else
            {
                int            lastIdx  = spline.GetPointCount() - 3;
                Span <Vector3> realPath = new Span <Vector3>(spline.GetPoints()).Slice(1);

                movementSpline.Points.Add(realPath[lastIdx]);

                if (lastIdx > 1)
                {
                    Vector3 middle = (realPath[0] + realPath[lastIdx]) / 2.0f;

                    // first and last points already appended
                    for (int i = 1; i < lastIdx; ++i)
                    {
                        movementSpline.PackedDeltas.Add(middle - realPath[i]);
                    }
                }
            }
        }
コード例 #2
0
 public MovementMonsterSpline()
 {
     Move = new MovementSpline();
 }