IEnumerator SlideIn_RIGHT(float seconds) { // 時間計測開始 ProcessTimer processTimer = new ProcessTimer(); processTimer.Restart(); //!< Obj生成 GameObject obj = Instantiate(slidePrefab); // キャンバスに設置 obj.transform.SetParent(GameObject.Find("Canvas").transform, false); obj.transform.localScale = new Vector3(1.1f, 1.1f, 1); obj.transform.Rotate(0.0f, 0.0f, 3.0f, Space.World); //!< ラジアンに変換 (3.0度→) float rad = 3.0f * Mathf.Deg2Rad; while (seconds > processTimer.TotalSeconds) { float move = Easing.QuintOut(processTimer.TotalSeconds, seconds, 0, 2050.0f); obj.transform.localPosition = new Vector3(move * Mathf.Cos(rad), move * Mathf.Sin(rad), 0); // 継続 yield return(null); } Debug.Log("スライドイン終了"); // いらん Destroy(obj); }
IEnumerator SlideIn_UP(float seconds) { // 時間計測開始 ProcessTimer processTimer = new ProcessTimer(); processTimer.Restart(); //!< Obj生成 GameObject obj = Instantiate(slidePrefab); // キャンバスに設置 obj.transform.SetParent(GameObject.Find("Canvas").transform, false); while (seconds > processTimer.TotalSeconds) { float y = Easing.QuintOut(processTimer.TotalSeconds, seconds, 0, 1080.0f); obj.transform.localPosition = new Vector3(0, y, 0); // 継続 yield return(null); } // いらん Destroy(obj); Debug.Log("スライドイン終了"); }
//======================================== // シーン用フェードイン [秒] 指定 //======================================== public IEnumerator SceneFadeIn(float seconds) { // 時間計測開始 ProcessTimer processTimer = new ProcessTimer(); processTimer.Restart(); //!< 色情報 float alpha = 1.0f; Image image = GetComponent <Image>(); Color col = image.color; while (alpha > 0.0f) { // α値どんどん薄くなるよ alpha = 1.0f - processTimer.TotalSeconds / seconds; if (alpha < 0.0f) { alpha = 0.0f; } // ほんとはここで毎回Getしたくない...。けど事前にGetしても上手くいかない...。 image.color = new Color(0, 0, 0, alpha); // 継続 yield return(null); } Debug.Log("シーン_フェードイン終了"); // いらねぇ Destroy(this.gameObject); }
static void Main(string[] args) { ProcessTimer pc = new ProcessTimer(10000); pc.OnClkProcess += Pc_OnClkProcessAsync; Console.WriteLine("Hello World!"); Console.ReadLine(); }
public void LoadStart() { SceneManager.LoadScene("title"); ProcessTimer.Stop(); ProcessTimer.Reset(); Data.Time = 30; Data.Score = 0; Time.timeScale = 1; }
/// <summary> /// 默认结束处理 /// </summary> /// <param name="target"></param> /// <param name="total"></param> /// <param name="current"></param> public override void FinishedProcess(ProcessTimer <CommandTimerType, int> target, int total, int current) { DebugUtils.Log(InfoType.Info, "AutoCountTimer FinishedProcess"); target.SetCount(1, 0); target.AddTarget(CommandTimerType.Default); target.Produce(ProcessState.COOLDOWN, true, 3); target.Produce(ProcessState.PROCESS); target.Control(ProcessState.START); }
public static void CreateGenericTimer(TimeSpan Duration, ProcessTimer Action) { Timer NewTimer = new Timer { Enabled = true, Interval = Duration.TotalMilliseconds, AutoReset = true }; NewTimer.Elapsed += (sender, e) => Action.Invoke(sender, e); TimerList.Add(NewTimer); }
void ClearChannelDelta(int channel) { if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); } if (ChangingChannels.ContainsKey(channel)) { lock (lockObject1) { ChangingChannels.Remove(channel); if (ChangingChannels.Count == 0) { TimerIsTicking = false; ProcessTimer.Stop(); } } } if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); } }
IEnumerator AnimLeftBlue(float seconds) { //!< 時間計測開始 ProcessTimer processTimer = new ProcessTimer(); processTimer.Restart(); //!< 保存用 Vector3 pos = this.gameObject.transform.position; //!< ラジアンに変換 (3.0度→) float rad = 3.0f * Mathf.Deg2Rad; while (seconds > processTimer.TotalSeconds) { float move = Easing.CubicOut(processTimer.TotalSeconds, seconds, -1100, 0.0f); this.gameObject.transform.localPosition = new Vector3(move * Mathf.Sin(rad), move * Mathf.Cos(rad), 0); // 継続 yield return(null); } // 調整用 this.gameObject.transform.position = pos; }
void ProcessTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); } List <int> keys = new List <int>(ChangingChannels.Keys); foreach (int channel in keys) { decimal newValue = ChangingChannels[channel].Value + ChangingChannels[channel].Delta; if (newValue > byte.MaxValue) { newValue = byte.MaxValue; } ChangingChannels[channel].Value = newValue; ChangingChannels[channel].MillisecondsRemaining -= Convert.ToInt32(ProcessTimer.Interval); ApplyNewChannelValue(channel, Convert.ToByte(newValue)); if (ChangingChannels[channel].MillisecondsRemaining <= 0) { ChangingChannels.Remove(channel); if (ChangingChannels.Count == 0) { ProcessTimer.Stop(); } } } if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); } }
void SetChannelDelta(int channel, byte startValue, decimal delta, int milliseconds) { if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); } if (!ChangingChannels.ContainsKey(channel)) { ChangingChannels.Add(channel, new ChangingChannelDefinition(startValue, delta, milliseconds)); } else { ChangingChannels[channel] = new ChangingChannelDefinition(startValue, delta, milliseconds); } if (!TimerIsTicking) { ProcessTimer.Start(); TimerIsTicking = true; } if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); } }
public IEnumerator StartEventing() { //!< 時間計測開始 float seconds = 1.0f; ProcessTimer processTimer = new ProcessTimer(); //!< 色情報取得 Image image = this.GetComponent <Image>(); Color col = image.color; //===================================================== // 右から登場+縦サイズ変更+α値↑ //===================================================== seconds = 0.6f; processTimer.Restart(); while (seconds > processTimer.TotalSeconds) { // QuadIn float x = Easing.BackOut(processTimer.TotalSeconds, seconds, 500.0f, 0.0f, 1.0f); float h = Easing.QuartOut(processTimer.TotalSeconds, seconds, 0.3f, 1.0f); float a = Easing.QuartOut(processTimer.TotalSeconds, seconds, 0.2f, 1.0f); this.transform.localPosition = new Vector3(x, 0, 0); this.transform.localScale = new Vector3(1.0f, h, 1.0f); image.color = new Color(col.r, col.g, col.b, a); // 継続 yield return(null); } // 調整用 this.transform.localPosition = new Vector3(0, 0, 0); this.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); image.color = new Color(col.r, col.g, col.b, 1.0f); //===================================================== // 待機 //===================================================== yield return(new WaitForSecondsRealtime(0.1f)); //===================================================== // サイズ縮小+α値↓ //===================================================== seconds = 0.35f; processTimer.Restart(); while (seconds > processTimer.TotalSeconds) { // QuadIn float wh = Easing.CubicOut(processTimer.TotalSeconds, seconds, 1.0f, 0.6f); float a = Easing.SineIn(processTimer.TotalSeconds, seconds, 1.0f, 0.5f); this.transform.localScale = new Vector3(wh, wh, 1.0f); image.color = new Color(col.r, col.g, col.b, a); // 継続 yield return(null); } // 調整用 this.transform.localScale = new Vector3(0.6f, 0.6f, 1.0f); image.color = new Color(col.r, col.g, col.b, 0.5f); //===================================================== // サイズ拡大+α値↓ //===================================================== seconds = 0.45f; processTimer.Restart(); while (seconds > processTimer.TotalSeconds) { // QuadIn float wh = Easing.CubicOut(processTimer.TotalSeconds, seconds, 0.6f, 1.6f); float a = Easing.SineIn(processTimer.TotalSeconds, seconds, 0.5f, 0.0f); this.transform.localScale = new Vector3(wh, wh, 1.0f); image.color = new Color(col.r, col.g, col.b, a); if (!isStart) { if (wh >= 1.0f) { // 本編動き出す StageManager.Instance.SetFlg(StageFlg.NOMAL); isStart = true; } } // 継続 yield return(null); } // 調整用 //this.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); //image.color = new Color(col.r, col.g, col.b, 0.0f); //Destroy(this.gameObject); }
public override int OneProcess(ProcessTimer <CommandTimerType, int> target, CommandTimerType msg, int total, int current) { DebugUtils.Log(InfoType.Info, "AutoCountTimer OneProcess"); return(0); }
IEnumerator LoadNextScene(string sceneName) { //========================================================== // 遷移前の演出挟むならココ! //========================================================== BaseSceneManager.Instance.SetObject(true); // 計測開始 ProcessTimer processTimer = new ProcessTimer(); processTimer.Restart(); Debug.Log("ロード先 : " + sceneName); //Debug.Log("現在読み込まれてるシーンの数 : " + SceneManager.sceneCount + " 個"); //foreach (Scene s in SceneManager.GetAllScenes()) { Debug.Log(s.name); } // 非同期でロード開始させる (追加) AsyncOperation async = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive); // ロード完了時に自動的に遷移させないようにする async.allowSceneActivation = false; // 確認用 //Debug.Log("allowSceneActivation : " + async.allowSceneActivation); //Debug.Log("start while : " + async.progress); // ロードが完了していない間ループする // ※allowSceneActivationがfalseの場合、progressは「0.9f」、isDoneは「false」で終わるので注意! // ※演出などで確実に待ちを入れたい場合は ( async.progress < 0.9f || 読み込み時間 < 確実に待たせたい時間[] ) while (async.progress < 0.9f || processTimer.TotalSeconds < waitSeconds) { // ローディングの進捗状況 //Debug.Log("while : " + async.progress); // シーンの読み込みが終わったらtrueになるよ...と思っていた時期が私にもありました。 //Debug.Log("isDone : " + async.isDone); yield return(null); } // ロード完了! Debug.Log("Loading Completed!"); //========================================================== // 遷移直前の演出挟むならココ! (BaseSceneでのFadeOutなど) //========================================================== // // // // 遷移許可 async.allowSceneActivation = true; // 現在のステージNo.を更新 switch (sceneName) { case "Stage1": GameDataManager.Instance.SetNowStageNo(1); break; case "Stage2": GameDataManager.Instance.SetNowStageNo(2); break; case "Stage3": GameDataManager.Instance.SetNowStageNo(3); break; case "Stage4": GameDataManager.Instance.SetNowStageNo(4); break; case "Stage5": GameDataManager.Instance.SetNowStageNo(5); break; case "Stage6": GameDataManager.Instance.SetNowStageNo(6); break; case "Stage7": GameDataManager.Instance.SetNowStageNo(7); break; case "Stage8": GameDataManager.Instance.SetNowStageNo(8); break; case "Stage9": GameDataManager.Instance.SetNowStageNo(9); break; } // ※ここでBaseSceneのObjを消した時にはまだシーン遷移されず、一瞬虚無フィールドが映ってしまう。 // フェードアウトすればたぶん問題ないが、できれば修正したい。→各シーンのStart()でfalse処理を行うと綺麗にいった...それでいいのか //BaseSceneManager.Instance.ObjectSet(false); }