void Update() { _ended = 0; if (_valueSize == 0) //DelayedCall { if (_elapsedTime >= _delay + _duration) { _ended = 1; } return; } if (!_started) { if (_elapsedTime < _delay) { return; } _started = true; CallStartCallback(); if (_killed) { return; } } bool reversed = false; float tt = _elapsedTime - _delay; if (_breakpoint >= 0 && tt >= _breakpoint) { tt = _breakpoint; _ended = 2; } if (_repeat != 0) { int round = Mathf.FloorToInt(tt / _duration); tt -= _duration * round; if (_yoyo) { reversed = round % 2 == 1; } if (_repeat > 0 && _repeat - round < 0) { if (_yoyo) { reversed = _repeat % 2 == 1; } tt = _duration; _ended = 1; } } else if (tt >= _duration) { tt = _duration; _ended = 1; } _normalizedTime = EaseManager.Evaluate(_easeType, reversed ? (_duration - tt) : tt, _duration, _easeOvershootOrAmplitude, _easePeriod); _value.SetZero(); _deltaValue.SetZero(); if (_valueSize == 5) { double d = _startValue.d + (_endValue.d - _startValue.d) * _normalizedTime; if (_snapping) { d = Math.Round(d); } _deltaValue.d = d - _value.d; _value.d = d; } else if (_valueSize == 6) { if (_ended == 0) { Vector3 r = UnityEngine.Random.insideUnitSphere; r.x = r.x > 0 ? 1 : -1; r.y = r.y > 0 ? 1 : -1; r.z = r.z > 0 ? 1 : -1; r *= _startValue.w * (1 - _normalizedTime); _deltaValue.vec3 = r; _value.vec3 = _startValue.vec3 + r; } else { _value.vec3 = _startValue.vec3; } } else if (_path != null) { Vector3 vec3 = _path.GetPointAt(_normalizedTime); if (_snapping) { vec3.x = Mathf.Round(vec3.x); vec3.y = Mathf.Round(vec3.y); vec3.z = Mathf.Round(vec3.z); } _deltaValue.vec3 = vec3 - _value.vec3; _value.vec3 = vec3; } else { for (int i = 0; i < _valueSize; i++) { float n1 = _startValue[i]; float n2 = _endValue[i]; float f = n1 + (n2 - n1) * _normalizedTime; if (_snapping) { f = Mathf.Round(f); } _deltaValue[i] = f - _value[i]; _value[i] = f; } } if (_target != null && _propType != TweenPropType.None) { TweenPropTypeUtils.SetProps(_target, _propType, _value); } CallUpdateCallback(); }
void Update() { _ended = 0; if (_valueSize == 0) //DelayedCall { if (_elapsedTime >= _delay + _duration) { _ended = 1; } return; } if (!_started) { if (_elapsedTime < _delay) { return; } _started = true; CallStartCallback(); if (_killed) { return; } } bool reversed = false; float tt = _elapsedTime - _delay; if (_breakpoint >= 0 && tt >= _breakpoint) { tt = _breakpoint; _ended = 2; } if (_repeat != 0) { int round = (int)Math.Floor(tt / _duration); tt -= _duration * round; if (_yoyo) { reversed = round % 2 == 1; } if (_repeat > 0 && _repeat - round < 0) { if (_yoyo) { reversed = _repeat % 2 == 1; } tt = _duration; _ended = 1; } } else if (tt >= _duration) { tt = _duration; _ended = 1; } _normalizedTime = EaseManager.Evaluate(_easeType, reversed ? (_duration - tt) : tt, _duration, _easeOvershootOrAmplitude, _easePeriod); _value.SetZero(); _deltaValue.SetZero(); if (_valueSize == 5) { double d = _startValue.d + (_endValue.d - _startValue.d) * _normalizedTime; if (_snapping) { d = Math.Round(d); } _deltaValue.d = d - _value.d; _value.d = d; } else if (_valueSize == 6) { if (_ended == 0) { Vector2 r = new Vector2(ToolSet.Random(-1.0f, 1.0f), ToolSet.Random(-1.0f, 1.0f)); r.X = r.X > 0 ? 1 : -1; r.Y = r.Y > 0 ? 1 : -1; r *= _startValue.w * (1 - _normalizedTime); _deltaValue.vec2 = r; _value.vec2 = _startValue.vec2 + r; } else { _value.vec2 = _startValue.vec2; } } else { for (int i = 0; i < _valueSize; i++) { float n1 = _startValue[i]; float n2 = _endValue[i]; float f = n1 + (n2 - n1) * _normalizedTime; if (_snapping) { f = (float)Math.Round(f); } _deltaValue[i] = f - _value[i]; _value[i] = f; } } if (_target != null && _propType != TweenPropType.None) { TweenPropTypeUtils.SetProps(_target, _propType, _value); } CallUpdateCallback(); }