private static IEnumerator process(TransforPointIndex originBorn, AnimationCurve pop, float popTime) { ColorScreen.Main.SetColor(Color.black, 0); var getFinished = SceneTransforer.Main.TransforToPoint(originBorn, 1); yield return(new WaitUntil(getFinished)); PlayerProperty.Main.born = originBorn; yield return(new WaitForSeconds(1)); Func <bool> xoCtrlConnected = () => { var names = Input.GetJoystickNames(); return(names.Length != 0 && names[0] != ""); }; var path = xoCtrlConnected() ? gamepadPath : keyboardPath; CameraSprite ctrlSprite = new CameraSprite("CtrlPadUI", path, Vector2.right); var originScale = ctrlSprite.transform.localScale; Func <float> getScale = () => ctrlSprite.transform.localScale.x / originScale.x; Action <float> setScale = (f) => ctrlSprite.transform.localScale = originScale * f; ClassRef <float> scaleRef = new ClassRef <float>(setScale, getScale); Time.timeScale = 0; scaleRef.set(0); float timeCount = 0; while (timeCount < 1) { yield return(null); timeCount += Time.unscaledDeltaTime / popTime; timeCount = Mathf.Clamp01(timeCount); scaleRef.set(pop.Evaluate(timeCount)); } yield return(new WaitUntil(() => Input.anyKey)); var s = getScale(); timeCount = 0; while (timeCount < 1) { yield return(null); timeCount += Time.unscaledDeltaTime / 0.3f; timeCount = Mathf.Clamp01(timeCount); scaleRef.set(Mathf.Lerp(s, 0, timeCount)); } ctrlSprite.Destroy(); Time.timeScale = 1; }
public void Update() { var dir = basePosGet() - originPos; dir = VectorUtils.Multiply(dir, degrees); pivotRef.set(dir + originPos); }
public IEnumerator MoveToPos(Vector2 pos, float time, AnimationCurve timeDisCurve) { var dir = pos - posRef.get(); var dis = dir.magnitude; var originPos = posRef.get(); float timeCount = 0; while (timeCount < 1) { yield return(null); timeCount += Time.unscaledDeltaTime / time; timeCount = Mathf.Clamp01(timeCount); var normedDis = timeDisCurve.Evaluate(timeCount); posRef.set(originPos + dir.normalized * normedDis * dis); } yield break; }
public static AlphaRef ColorAlpha(ClassRef <Color> color) { Func <float> get = () => color.get().a; Action <float> set = (a) => { var col = color.get(); col.a = a; color.set(col); }; return(new AlphaRef(set, get)); }
public static ClassRef <Color> SRGBToLiner(ClassRef <Color> srgb) { return(new ClassRef <Color>((c) => srgb.set(VectorUtils.Do(c, f => Mathf.Pow(f, 1 / 2.2f))), () => VectorUtils.Do(srgb.get(), f => Mathf.Pow(f, 2.2f)))); }