private void SpawnObject() { StartThrownigPosition.x = _minScreenPosition.x + _widthOfScreen * _currentLvlPreset.TrowingObjects[_numberOfObject].PositionOfThrowing; _throwedObject = Instantiate(FallingObjects[Random.Range(0, FallingObjects.Length)], StartThrownigPosition, Quaternion.identity); _numberOfObject++; _throwedObjectScript = _throwedObject.GetComponent <ThrowingObject>(); _throwedObjectScript.SetCounter(_counter); _throwedObjectScript.SetForce(_currentLvlPreset.TrowingObjects[_numberOfObject - 1].ForceOfThrowing); _throwedObjectScript.TrowObjectUp(); }
private void SpawnCoin() { StartThrownigPosition.x = _minScreenPosition.x + _widthOfScreen * Random.Range(0f, 1f); _throwedObject = Instantiate(Coin, StartThrownigPosition, Quaternion.identity); //NumberOfObject++; _throwedObjectScript = _throwedObject.GetComponent <ThrowingObject>(); _throwedObjectScript.SetCounter(_counter); _throwedObjectScript.SetForce(Random.Range(3000f, 3501f)); _throwedObjectScript.TrowObjectUp(); }