private void SpawnBarrier() { var spawnArea = Spawnarea; if (spawnArea != null) { var position = SpawnHelper.RandomPositionInArea(spawnArea); if (position != null) { var b = SpawnHelper.TrySpawn(BarrierPrefab, position.Value, Quaternion.identity); if (b != null) { InitBarrier(b); UpdateLoadingPanel(); } } } }
void Update() { button.interactable = PlayerScript.Player.Money.GreaterThan(Hit.FromFullLife(Costs)); if (spawnBall && ballScript == null && BallPrefab != null) { var spawnArea = GameScript.Game.Spawnarea; var bo = SpawnHelper.TrySpawn(BallPrefab, spawnArea.transform.position, spawnArea.bounds.size, Quaternion.identity); if (bo != null) { SpawnHelper.SetParentInHierarchy(bo, ballsSpawnParent); //Debug.Log("Spawn Ball"); ballScript = bo.GetComponent <BallScript>(); ballScript.HitForce = spawnBallForce; ballScript.Speed = Speed; ballScript.Mass = Mass; spawnBall = false; } } PermanentEffect_FullUpgrade(); }