void StartMover() { if (moving) { return; } moving = true; Vector3 f = GetPointAtPosition(path[pathPosition]); Vector3 t = GetPointAtPosition(path[pathPosition + 1]); pointPosition = path[pathPosition + 1]; Vector3 next = pathPosition + 2 < path.Count - 1 ? GetPointAtPosition(path[pathPosition + 2]) : new Vector3(-1, -1, -1); rotator.InitMovement(f, t, next); pathPosition++; float speed = 2f; float distance = Vector3.Distance(f, t); float time = distance / speed; Co2.StartCoroutine( time, (float p) => { Move(p, f, t); }, OnArriveAtPoint ); }
public void Swell(float duration, bool repeat = false) { Co2.StartCoroutine(duration, (float p) => { Fill = Mathf.Sin(Mathf.PI * p); }, () => { if (repeat) { Swell(duration, true); } }); }
public bool Start () { // Don't allow the action to overlap itself if (!Enabled || performing) return false; performing = true; perform = true; Log ("Start", true); OnStart (); Co2.StartCoroutine (Duration #if QUARTER_TIME *0.25f #else , SetProgress, End); #endif return true; }