Example #1
0
        public static CamNode GetPoint(ICamMotion movement, List <CamNode> points, double percent, int currentLoop, int loops)
        {
            var lengthOfPoint  = 1.0 / (points.Count - 1);
            var currentPoint   = Math.Min((int)(percent / lengthOfPoint), points.Count - 2);
            var point1         = points[currentPoint];
            var point2         = points[currentPoint + 1];
            var percentOfPoint = percent % lengthOfPoint;

            return(movement.GetPointInBetween(point1, point2, percentOfPoint, percent, currentLoop == 0, currentLoop == loops));
        }
        public void Finish(IClientWorldAccessor world)
        {
            HasFinished = true;
            IsRunning   = false;

            _cachedMode.OnPathFinish();
            TempNodes = null;

            _cachedMode         = null;
            CachedInterpolation = null;

            (world as ClientMain).SetField("ShouldRender2DOverlays", _hideGui);
        }
        public void Start(IClientWorldAccessor world)
        {
            HasFinished = false;
            IsRunning   = true;

            _timeStarted = DateTime.Now;
            _currentLoop = 0;
            TempNodes    = new List <CamNode>(Nodes);
            if (_loop != 0)
            {
                TempNodes.Add(TempNodes[TempNodes.Count - 1].Clone());
            }


            var parser = CamMode.GetMode();

            _cachedMode = parser.Initialise(this);
            _cachedMode.OnPathStart();

            CachedInterpolation = CamMotionFactory.CreateInstance(_interpolation);
            CachedInterpolation.Initialise(TempNodes, _loop, Target);

            _hideGui = (world as ClientMain).GetField <bool>("ShouldRender2DOverlays");
        }