Exemple #1
0
	public void Play() {
		if (_tween != null) {
			_tween.Destroy();
			_tween = null;
		}
		
		_looping = true;
		
		Vector3 theStartPos = _startPosition;	
		Vector3 theEndPos =_startPosition + BounceOffset;
			
		if (_reverse) {
			theStartPos = _startPosition + BounceOffset;
			theEndPos = _startPosition;
		}
		
		//LOOP YOYO:
		_tween = Tween.to(theStartPos, theEndPos, LoopDuration, EaseType, 
			(Tween t) => { transform.localPosition = (Vector3) t.Value;},
			null,
			0f,
			Yoyo,
			LoopCount
		);
		
		if (RandomStartProgress) {
			_tween.SetProgress(Random.Range(0f, 1f));
		}
	}