void FixedUpdate() { if (!isTweenFinished) { isTweenFinished = _tweener.UpdateTime(Time.fixedDeltaTime, ref _currentTweenValue); _positionTarget = Vector2.LerpUnclamped(_positionCurrent, _moveTo, _currentTweenValue); transform.position = _positionTarget; if (isTweenFinished) { //Camera camera = Camera.main; //move(new Vector2(UnityEngine.Random.Range(-camera.orthographicSize, camera.orthographicSize - 2) + 2, UnityEngine.Random.Range(-camera.orthographicSize, camera.orthographicSize - 2) + 2)); } } }
void FixedUpdate() { if (!isTweenOutFinished) { isTweenOutFinished = _tweenerJumpOut.UpdateTime(Time.fixedDeltaTime, ref _currentTweenValue); transform.localScale = new Vector3(_currentTweenValue, _currentTweenValue, _currentTweenValue); if (isTweenOutFinished) { transform.position = _destinationPosition; } } else if (isTweenOutFinished && !isTweenInFinished) { isTweenInFinished = _tweenerJumpIn.UpdateTime(Time.fixedDeltaTime, ref _currentTweenValue); transform.localScale = new Vector3(_currentTweenValue, _currentTweenValue, _currentTweenValue); if (isTweenInFinished) { isTweenInAvailable = true; MoveToDestinationIfPossible(); } } }
void FixedUpdate() { if (!isTweenFinished) { isTweenFinished = _tweener.UpdateTime(Time.fixedDeltaTime, ref _currentTweenValue); _currentDistance = _distance * _currentTweenValue; _offYValue = Mathf.Sin(_currentTweenValue * (float)Math.PI * 2); _positionTarget = new Vector2( _positionCurrent.x + _currentDistance * _directionX, _positionCurrent.y + _offYValue ); transform.position = _positionTarget; transform.RotateAround(_positionCurrent, Vector3.forward, alphaDeg); transform.Rotate(Vector3.forward, -alphaDeg); if (isTweenFinished) { //Camera camera = Camera.main; //move(new Vector2(UnityEngine.Random.Range(-camera.orthographicSize, camera.orthographicSize - 2) + 2, UnityEngine.Random.Range(-camera.orthographicSize, camera.orthographicSize - 2) + 2)); } } }