void updateNodesMode()
        {
            if (currentNode == null || nextNode == null) return;

            Vector3 targetPosition = nextNode.position;
            Vector3 direction = targetPosition - Camera2D.position;
            float distance = direction.Length();
            direction.Normalize();
            float distanceToAdvance = currentNode.value.speed * SB.dt * speedMultiplier;

            // always check if the camera arrives to the next node in this frame
            if (distanceToAdvance > distance)
            {
                // camera arrives to the new node
                Camera2D.position = nextNode.position;
                // after that, how much time remains to keep moving to the new next node?
                currentNode = nextNode;
                nextNode = currentNode.getNext();
                if (nextNode == null) return;
                float timeRemaining = SB.dt - ((SB.dt * distance) / distanceToAdvance);
                // get the new values to move the camera to the new next node
                targetPosition = nextNode.position;
                direction = targetPosition - Camera2D.position;
                distance = direction.Length();
                direction.Normalize();
                distanceToAdvance = currentNode.value.speed * timeRemaining;
            }
            Camera2D.position += direction * distanceToAdvance;
        }
 public void setCurrentNode(NetworkNode<CameraData> node)
 {
     currentNode = node;
     nextNode = node.getNext();
 }