private void CreatePowerUp(int x, int y) { float random = Random.value; Transform powerupTransform; if (random < addPowerupProbability) { AddCoin addCoin = Instantiate(addCoinPrefab); addCoin.OnCollision += AddCoinCollision; powerupTransform = addCoin.transform; powerupTransform.SetParent(gridContainer); powerupTransform.localPosition = GetPositionFromModel(x, y); powerupTransform.localScale *= stepX; shapes.Add(powerupTransform); } }
private void AddCoinCollision(AddCoin collision) { shapes.Remove(collision.transform); ScoresAndCoins.SCM.AddCoins(); }