public void GoToNode(Node destination, Mode mode = Mode.pickup, Action onReached = null) { onDestinationReached = onReached; currentMode = mode; //Meme chemin if (currentPath != null && destination == currentPath.GetDestination()) { return; } if (state.IsInTransition()) { if (destination == state.transition.to) { //On va deja a la bonne place, on arrete la ClearPath(); return; } else if (destination == state.transition.from) { //On reviens sur nos pas et on arrete la state.transition.Flip(); hero.SetNode(state.transition.to); ClearPath(); return; } } else { if (state.stayNode == destination) { OnReachDest(); return; } } currentPath = Game.Fastar.CalculatePath(state.GetNextOrStayNode(), destination); if (state.IsInTransition()) { //Shit ! Go back ! if (currentPath.Get2ndClosest() == state.transition.from) { OnCompleteTransition(); } } else { PerformNextSegment(); } }