示例#1
0
        void InitSplines(List <Vector3> splinePoints, uint timeToTarget)
        {
            if (splinePoints.Count < 2)
            {
                return;
            }

            _movementTime = 0;

            _spline.Init_Spline(splinePoints.ToArray(), splinePoints.Count, Spline.EvaluationMode.Linear);
            _spline.initLengths();

            // should be sent in object create packets only
            updateValues[(int)AreaTriggerFields.TimeToTarget].UnsignedValue = timeToTarget;

            if (IsInWorld)
            {
                if (_reachedDestination)
                {
                    AreaTriggerReShape reshapeDest = new AreaTriggerReShape();
                    reshapeDest.TriggerGUID = GetGUID();
                    SendMessageToSet(reshapeDest, true);
                }

                AreaTriggerReShape reshape = new AreaTriggerReShape();
                reshape.TriggerGUID = GetGUID();
                reshape.AreaTriggerSpline.HasValue = true;
                reshape.AreaTriggerSpline.Value.ElapsedTimeForMovement = GetElapsedTimeForMovement();
                reshape.AreaTriggerSpline.Value.TimeToTarget           = timeToTarget;
                reshape.AreaTriggerSpline.Value.Points = splinePoints;
                SendMessageToSet(reshape, true);
            }

            _reachedDestination = false;
        }
示例#2
0
        void InitCircularMovement(AreaTriggerCircularMovementInfo cmi, uint timeToTarget)
        {
            // Circular movement requires either a center position or an attached unit
            Cypher.Assert(cmi.Center.HasValue || cmi.TargetGUID.HasValue);

            // should be sent in object create packets only
            updateValues[(int)AreaTriggerFields.TimeToTarget].UnsignedValue = timeToTarget;

            _circularMovementInfo.Set(cmi);

            _circularMovementInfo.Value.TimeToTarget           = timeToTarget;
            _circularMovementInfo.Value.ElapsedTimeForMovement = 0;

            if (IsInWorld)
            {
                AreaTriggerReShape reshape = new AreaTriggerReShape();
                reshape.TriggerGUID = GetGUID();
                reshape.AreaTriggerCircularMovement = _circularMovementInfo;

                SendMessageToSet(reshape, true);
            }
        }