// PUBLIC MODIFIERS public static void SetFactor(float factor, UID id) { TimeScaleManager I = Instance; I.product.SetFactor(factor, id); I.UpdateTimeScale(); }
/// <summary> /// Pause action /// </summary> /// <param name="pause"> Pause = true; Unpause = false.</param> public static void Pause(bool pause) { for (int i = 0; i < singleton.subscribers.Count; i++) { // Removing unsubbers if (singleton.subscribers[i] == null) { singleton.subscribers.RemoveAt(i); i--; continue; } // Pause action if (pause) { singleton.subscribers[i].Pause(); TimeScaleManager.SetTimeScale(0.0f); } else { singleton.subscribers[i].Unpause(); TimeScaleManager.SetTimeScale(0.0f); } } }
private IEnumerator MoveWorld() { if (moving) { yield break; } moving = true; SetAllObjectsInScene(); yield return(null); TimeScaleManager.SetTimeScale(0); var playerMoveOffset = player.position; player.position = Vector3.zero; foreach (var item in objectsInScene) { item.transform.position -= playerMoveOffset; } yield return(new WaitForEndOfFrame()); TimeScaleManager.SetTimeScale(1); moving = false; }
private void Awake() { instance = this; setSpeed(1); btnChanger(true); }
private IEnumerator StartTurn() { State = MatchState.TurnChange; int chaser_i = turn_num % 2; //Tools.Log(string.Format("turn {0}: chaser is p{1}", turn_num, chaser_i)); // Set chara roles charas[chaser_i].SetChaser(); for (int i = 0; i < charas.Length; ++i) { if (i != chaser_i) { charas[i].SetRunner(); } } // Flash chase screen TimeScaleManager.SetFactor(0, ui_timescale_id); match_ui.ShowChaseScreen(charas[chaser_i], charas[1 - chaser_i]); yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(0.5f))); match_ui.HideChaseScreen(GetChaser(), GetRunner()); TimeScaleManager.SetFactor(1, ui_timescale_id); turn_start_time = Time.timeSinceLevelLoad; State = MatchState.InPlay; }
private void Start() { instance = this; //Add a default scaler so we always have one in the list. NEVER remove this TimeScaler defaultScaler = new TimeScaler(1f); timeScalers.Add(defaultScaler); }
/// <summary> /// 手动创建单例,不会重复的 /// </summary> public static void TrySpawn() { if (!_instance) { var go = new GameObject("_TimeScaleManager"); DontDestroyOnLoad(go); _instance = go.AddComponent <TimeScaleManager>(); //这时候会触发Awake() } }
private IEnumerator Freeze(float frames = 3) { TimeScaleManager.SetFactor(0, freeze_timescale_id); for (int i = 0; i < frames; ++i) { yield return(null); } TimeScaleManager.SetFactor(1, freeze_timescale_id); }
public static void PauseGame(EPauseFrom from) { Debug.Log("PauseGame:" + from); SetPauseState(from, true); if (_stateFrom != EPauseFrom.None) { TimeScaleManager.SetTimeScaleForPause(0f); } }
public void UnPause() { paused = false; TimeScaleManager.SetFactor(1, timescale_id); pause_page.SetOut(); if (resume_sound != null) { resume_sound.Play(); } }
void Update() { if (!_inited) { return; } TimeScaleManager.Update(); SaveDataMgr.Update(); UiManager.Update(); }
public void Pause() { paused = true; TimeScaleManager.SetFactor(0, timescale_id); pause_page.SetIn(); if (pause_sound != null) { pause_sound.Play(); } }
public static void DoContionueGame(EPauseFrom from) { Debug.Log("DoContionueGame:" + from + " " + _stateFrom); SetPauseState(from, false); if (_stateFrom == EPauseFrom.None) { TimeScaleManager.SetTimeScaleForPause(1); } }
public static TimeScaleManager GetInstance() { if (_instance == null) { GameObject GO = new GameObject("TimeScaleManager"); GO.AddComponent <TimeScaleManager>(); _instance = GO.GetComponent <TimeScaleManager>(); DontDestroyOnLoad(GO); } return(_instance); }
private void Awake() { if (_instance == null) { _instance = this; } else { DestroyImmediate(this); } }
void Awake() { if (singleton == null) { singleton = this; } else { Debug.LogError("Duplicate PauseManager!"); } }
private void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
private void Debugger_Tick(object sender, EventArgs e) { DateTimeManager.DebugThisFrame(); TimeScaleManager.DebugThisFrame(); if (Game.GameTime > fpsUpdateTimer) { currentFps = Convert.ToInt32(Game.FPS); fpsUpdateTimer = Game.GameTime + 100; } Debug.DrawText(new GTA.Math.Vector2(0.49f, 0.03f), "FPS: " + currentFps.ToString("0")); }
private void Start() { _time = TimeScaleManager.Instance; int count = CloudsCount * CloudsCount; int batchCount = count / BatchSize + 1; _batches = new Batch[batchCount]; _tasks = new Task[batchCount]; for (int i = 0; i < batchCount; i++) { int length = Mathf.Min(BatchSize, count - i * BatchSize); _batches[i].Length = length; _batches[i].Clouds = new Cloud[length]; _batches[i].Objects = new Matrix4x4[length]; } float offset = -CloudsCount * 0.5f; for (int cloudY = 0; cloudY < CloudsCount; cloudY++) { for (int cloudX = 0; cloudX < CloudsCount; cloudX++) { Cloud cloud = new Cloud { Scale = 0, X = cloudX, Y = cloudY, }; Vector3 position = new Vector3 ( offset + transform.position.x + cloudX * CloudSize, transform.position.y, offset + transform.position.z + cloudY * CloudSize ); int index = cloudY * CloudsCount + cloudX; int x = index / BatchSize; int y = index % BatchSize; _batches[x].Clouds[y] = cloud; _batches[x].Objects[y] = Matrix4x4.TRS(position, Quaternion.identity, Vector3.zero); } } }
/// <summary> /// 清理所有东西。 /// </summary> public void Clear() { if (MyFighter) { MyFighter.DestroySelf(); } RoundData.Wave = 1; foreach (Transform child in GameContainer.transform) { Destroy(child.gameObject); } TimeScaleManager.ResetToStart(); //清理旧的Coroutine。 CoroutineManager.RemoveCoroutines(x => x.ID == "Game"); //清理UI if (GameUI.Instance) { } }
// PRIVATE MODIFIERS private void Awake() { // if this is the first instance, make this the singleton if (_instance == null) { _instance = this; DontDestroyOnLoad(_instance); Initialize(); } else { // destroy other instances that are not the already existing singleton if (this != _instance) { // save new inspector parameters //_instance.base_timescale = this.base_timescale; //_instance.maintain_fixedtimestep_ratio = this.maintain_fixedtimestep_ratio; //_instance.fixed_timestep = this.fixed_timestep; Destroy(this.gameObject); } } }
public void RevivePlayer() { TimeScaleManager.RemoveAllTimeScaleEffect(); RoundData.LastRespawnOrReviveTime = GameTime; }
void OnDestroy() { singleton = null; }
void Awake() { Instance = this; enabled = false; }
void Awake() { instance = this; timeScale = TimeScale.ONE; Time.timeScale = 0f; isPlaying = false; }
private void Start() { _terraingGenerator = GetComponent <TerrainGenerator>(); _waterTiles = _terraingGenerator.GetTilesByType(TileType.Water); _timeScale = TimeScaleManager.Instance; }
// PRIVATE MODIFIERS private void Awake() { // if this is the first instance, make this the singleton if (_instance == null) { _instance = this; DontDestroyOnLoad(_instance); Reset(); } else { // destroy other instances that are not the already existing singleton if (this != _instance) { // save new inspector parameters _instance.default_timescale = this.default_timescale; _instance.maintain_fixedtimestep_ratio = this.maintain_fixedtimestep_ratio; _instance.fixed_timestep = this.fixed_timestep; Destroy(this.gameObject); _instance.Reset(); } } }
public static void Revert() { _stateFrom = EPauseFrom.None; TimeScaleManager.SetTimeScaleForPause(1); }
private void Awake() { Instance = this; }
// Use this for initialization void Start() { TimeScaleManager.GetInstance(); }