public void reset() { Function.Call(Hash.DISPLAY_RADAR, true); Function.Call(Hash.DISPLAY_HUD, true); GUIManager.Instance.missionUI.show(); if (transitionTimer != null) { transitionTimer.interrupt(); transitionTimer = null; } foreach (CameraShot cameraShot in this.sequence) { cameraShot.destroyCamera(); } this.sequence.Clear(); this.current_element = null; this.sequenceElapsedTime = 0; this.sequence_total_duration = 0; this.current_index = -1; this.current_element_elapsed_time = 0; }
public static void setClockTime(int newHour, float transitionDuration = 0, bool onlyForward = false) { int currentHour = Function.Call <int>(Hash.GET_CLOCK_HOURS); newHour = newHour % 24; float hoursToAdd = (newHour > currentHour) ? (newHour - currentHour) : ((newHour + 24) - currentHour); if (!onlyForward && hoursToAdd > 12) { hoursToAdd = 24 - hoursToAdd; } if (clockTransitionTimer != null) { Tools.log("clockTransitionTimer interrupt"); clockTransitionTimer.interrupt(); } if (transitionDuration <= 0) { Function.Call(Hash.SET_CLOCK_TIME, newHour, 0, 0); } else { clockTransitionTimer = new Timer(transitionDuration); clockTransitionTimer.OnTimerUpdate += (elapsedMilliseconds, elapsedPourcent) => { float floatingHour = (currentHour + (hoursToAdd * elapsedPourcent)) % 24; int hour = (int)Math.Floor(floatingHour), minute = (int)Math.Floor(((floatingHour - hour) * 60) % 60); Function.Call(Hash.SET_CLOCK_TIME, hour, minute, 0); }; clockTransitionTimer.OnTimerInterrupt += (sender, elapsedMilliseconds) => { clockTransitionTimer = null; }; } }