private void CreatePowerUp(int x, int y) { float value = UnityEngine.Random.value; this.SpawnChance = value; BasicCell cell; if (value < this.addBallProbability) { AddBall addBall = UnityEngine.Object.Instantiate <AddBall>(this.addBallPrefab); AddBall expr_26 = addBall; expr_26.OnCollision = (Action <AddBall>)Delegate.Combine(expr_26.OnCollision, new Action <AddBall>(this.AddBall_OnCollision)); cell = addBall; } else if (value < this.addCoinProbability) { AddBomb addBomb = UnityEngine.Object.Instantiate <AddBomb>(this.addBombPrefab); AddBomb expr_6C = addBomb; expr_6C.OnCollision = (Action <AddBomb>)Delegate.Combine(expr_6C.OnCollision, new Action <AddBomb>(this.AddBomb_OnCollision)); cell = addBomb; } else { AddCoin addCoin = UnityEngine.Object.Instantiate <AddCoin>(this.addCoinPrefab); AddCoin expr_A8 = addCoin; expr_A8.OnCollision = (Action <AddCoin>)Delegate.Combine(expr_A8.OnCollision, new Action <AddCoin>(this.AddCoin_OnCollision)); cell = addCoin; } cell.transform.SetParent(this.gridContainer); cell.transform.localPosition = this.GetPositionFromModel(x, y); this.cells.Add(cell); }
private void AddBall_OnCollision(AddBall sender) { this.cells.Remove(sender); this.ballToAddCount++; }