private void CheckIfPlayerIsClose() { if (IsPlayerClose()) { //use this function to change one active function to another procHost.SwapProcesses(CheckIfPlayerIsClose, InitEntities); } }
private void DriveFiber() { var sw = new Stopwatch(); sw.Start(); while (DetectivePed.DistanceTo(TargetPosition) > 5.5f) { GameFiber.Yield(); #if DEBUG Game.DisplaySubtitle(DetectivePed.DistanceTo(TargetPosition).ToString()); #endif if (sw.Elapsed.TotalSeconds > 45) { WarpToPosition(); } GameFiber.Yield(); } _processHost.SwapProcesses(DriveFiber, ExitVehicleAndGoToPos); }
// MAIN LOGIC private void QuestionDisplay() { if (Player.DistanceTo(DetectivePed) > StartDistance) { return; } DisplayLine(Conversation[_conversationLine].Question, DetectivePed); _procHost.SwapProcesses(QuestionDisplay, UserInput); }
protected void SwapStages(Action toDisable, Action toEnable) => ProcHost.SwapProcesses(toDisable, toEnable);