IEnumerator scaler(float MaximumScaleAdder = 0.2f, float time = 0.2f, float period = 0.1f) { CWait wait = new CWait(time); var targetCamera = target_pivot; float scaleaddr = MaximumScaleAdder; while (wait.NotYet) { lefttime = wait.Left; //if (scPause.IsPlaying) { //1 period = 민-맥스-민 의 1사이클 = 1pi 만큼의 시간 //즉 점점 줄어드는 period 를 가져야한다. //MaximumScaleAddr 은 time동안 지속적으로 줄어든다. scaleaddr = MaximumScaleAdder * wait.LeftRatioSin; //targetCamera.VRun(v => v.transform.localScale = Vector3.one + Vector3.one * scaleaddr * Mathf.Sin(wait.FlowedRatio * (time / period) * Mathf.PI)); targetCamera.VRunEach(v => v.GetComponent <Camera>().orthographicSize = 1 + scaleaddr * Mathf.Sin(wait.FlowedRatio * (time / period) * Mathf.PI)); // float flowedSineX = ((wait.FlowedRatio * Mathf.PI * 2)); //time동안 1주기를 도는 싸인의 x값. // float SineXPeriodPerSec = flowedSineX * time; //time 만큼의 주기를 돈다. 즉 time2 면 time동안 2주기 = 1초ㅓ에 1주기 // float move = Mathf.Sin(SineXPeriodPerSec / period); //period 에 1주기를 돈다. // // float amplitude = BeginScale * wait.LeftRatio; // float finalScaler = move * amplitude; // targetCamera.transform.localScale = Vector3.one * finalScaler; } yield return(null); } Stop(); }
/// <summary> /// 접속 stub /// 향후 이곳에서 실제 접속을 처리하게 될 것 /// </summary> /// <returns></returns> IEnumerator main() { #if UNITY_EDITOR //cursor visible Cursor.visible = true; //load pre_configuration // System.IO.StreamReader sr = new System.IO.StreamReader("configuration_dev.txt"); // string data = sr.ReadToEnd(); // var dic = MiniJSON.Json.Deserialize(data) as Dictionary<string, object>; // sr.Close(); #endif //load reftable yield return(Reftable.Instance.Initialize().VPlay()); //connection stub yield return(CWait.ForSeconds_IgnorePause(1)); //wait for additional some more frames yield return(null); yield return(null); //scScreenLog.Instance.Log(3); //finished UnityEngine.SceneManagement.SceneManager.LoadScene("maingame"); //scScreenLog.Instance.Log(19); }
IEnumerator main() { GameInitializer.NowLoading = true; yield return(CWait.ForSeconds_IgnorePause(1)); UnityEngine.SceneManagement.SceneManager.LoadScene("connect"); }
static IEnumerator forSeconds(float time, bool ignore_pause) { var w = new CWait(time); w.IgnorePause = ignore_pause; while (w.NotYet) { yield return(null); } }
public Mover(Transform target, Transform body, float time, int curve, bool surpress) { waiter = new CWait(time); Body = body; Target = target; MoveFinished = false; beginpos = body.position; manager = scMover.Instance; surpressStopPrev = surpress; curve_0normal_1sin_2oneminuscos_3sin0toquaterpi = curve; unique_id = id_generator++; IsPaused = false; }
/// <summary> /// coroutineouter 를 쓰기위해 한겹 더 쌈 /// </summary> /// <param name="target"></param> /// <param name="axis"></param> /// <param name="time"></param> /// <param name="period"></param> /// <param name="BeginAmplitude"></param> /// <returns></returns> IEnumerator shake(Vector2 axis, float BeginAmplitude = CameraShakeBasicAmplitude, float time = CameraShakeBasicTime, float period = CameraShakeBasicPeriod) { CWait wait = new CWait(time); var targetCamera = target_pivot; axis.Normalize(); wait.IgnorePause = true; while (wait.NotYet) { lefttime = wait.Left; float flowedSineX = ((wait.FlowedRatio * Mathf.PI * 2)); //time동안 1주기를 도는 싸인의 x값. float SineXPeriodPerSec = flowedSineX * time; //time 만큼의 주기를 돈다. 즉 time2 면 time동안 2주기 = 1초ㅓ에 1주기 float move = Mathf.Sin(SineXPeriodPerSec / period); //period 에 1주기를 돈다. float amplitude = BeginAmplitude * wait.LeftRatio; Vector3 finalMover = (axis * move * amplitude); targetCamera.VRunEach(v => Util.Put2DOnly(v.transform, finalMover + v.transform.position)); yield return(null); } Stop(); }
public static CoroutineClass UntilFinish(this scMover.Mover m) { return(CWait.ForSeconds(m.waiter.Left)); }