private void CreateBubble(float size, Vector3 position) { _creationTimer = GameSettings.CreationTimeout; var sphere = SimplePool.GetSphere(BubbleSettings.SpherePrefab); var sphereTransform = sphere.transform; sphereTransform.localScale = Vector3.one * size; sphereTransform.localPosition = position; var gameSphere = sphere.GetComponent <GameSphere>(); if (!gameSphere) { gameSphere = sphere.AddComponent <GameSphere>(); } var sizeLerp = Mathf.InverseLerp(BubbleSettings.Size.x, BubbleSettings.Size.y, size); var speedBySize = Mathf.Lerp(BubbleSettings.SpeedBySize.x, BubbleSettings.SpeedBySize.y, sizeLerp); var scoreBySize = Mathf.Lerp(BubbleSettings.ScoreBySize.x, BubbleSettings.ScoreBySize.y, sizeLerp); gameSphere.StartAscent(BubbleSettings.StartSpeed + _increasedSpeed + speedBySize, scoreBySize); }