On Overlap if (!moving) { if (currentLocation != destination) } moving = true Timeline.start() } } Timeline.Tick() { pos = LERP(Destinations[currentLocation],Destinations[destination]); SetLocation(pos); } int ChooseRandomDestination() { while (Destination == CurrentLocation) { Destination = RandBetween(0, Destinations.size()-1); } } Timeline.Finished() { moving = false; Current Location = Destination; Destination = ChoseRandomDestination(); }
On Overlap(){ if (!hit) { Transporter.Destinations.push_back(newLocation); Transporter.destination = Transporter.Destinations.size()-1; } }