private void SpawnCloneBall(float size) { CloneBall newCloneBall = Instantiate(CloneBallPrefab, playerBall.SpawnPoint, Quaternion.identity).GetComponent <CloneBall>(); newCloneBall.Spawn(size); playerBall.NewCloneBall = newCloneBall; }
public void SetBonus(BonusTypes bonusType) { switch (bonusType) { case BonusTypes.SpeedBoost: SpeedBoost speedBoost = GameObject.FindObjectOfType <SpeedBoost>(); if (speedBoost == null) { GameObject go = new GameObject(); go.name = "SpeedBoost"; speedBoost = go.AddComponent <SpeedBoost>(); } speedBoost.ApplyBonus(); break; case BonusTypes.IncreasePlatform: IncreasePlatform increasePlatform = GameObject.FindObjectOfType <IncreasePlatform>(); if (increasePlatform == null) { GameObject go = new GameObject(); go.name = "IncreasePlatform"; increasePlatform = go.AddComponent <IncreasePlatform>(); } increasePlatform.ApplyBonus(); break; case BonusTypes.CloneBall: CloneBall cloneBall = GameObject.FindObjectOfType <CloneBall>(); if (cloneBall == null) { GameObject go = new GameObject(); go.name = "CloneBall"; cloneBall = go.AddComponent <CloneBall>(); } cloneBall.ApplyBonus(); break; default: break; } }