Powerups on arkanoid game C#

Hi everyone, I’ve written a little arkanoid game and need little bit help with my powerups system.

Here’s my powerup script:

using UnityEngine;
using System.Collections;

public class PowerUpScript : MonoBehaviour {
	
	public AudioClip[] powerupaudio;
	
	public int PowerUp = 100;

	// Use this for initialization
	void Start () {
	}
	
	// Update is called once per frame
	void Update () {
		rigidbody.AddTorque( Vector3.forward * 2f );
		rigidbody.AddForce ( Vector3.right * 3f);
	}
	
	void OnCollisionEnter ( Collision col ) {
		Destroy ( gameObject );
		PaddleScript paddleScript= GameObject.Find ("Paddle").GetComponent<PaddleScript>();
		paddleScript.AddPoint(PowerUp);
		
		AudioSource.PlayClipAtPoint(powerupaudio[0], transform.position);
		
		BrickScript brickScript= GameObject.Find ("Brick").GetComponent<BrickScript>();
		
		//powerups
		foreach(GameObject pw in brickScript.powerUpPrefabs){
			 switch(pw.transform.name){
			 case "Big_Paddle":
				 GameObject.Find ("Paddle").transform.localScale += new Vector3(1F, 0, 0);
				 break;
			 case "More_Points":
				 paddleScript.AddPoint (1000);
				 break;
			 }
		}
	}
}

And the problem with this is that no matter which powerup you’ll take it’s always the same: Big_Paddle. So if you take more points powerup, it’s still bigger paddle powerup, what I’m doing wrong here?

I’m guessing that brickScript.powerUpPrefabs contains all the possible powerups.
So iterating it in line 30 will always yield the same result, the first powerup of the list of all powerups available, in your case the Big Paddle.

In your OnCollisionEnter() you completely ignored which objects were part of the collision!

So instead of iterating the entire list you should check which object you collided with:

void OnCollisionEnter ( Collision col ) {
	PaddleScript paddleScript= GameObject.Find ("Paddle").GetComponent<PaddleScript>();
	paddleScript.AddPoint(PowerUp);

	AudioSource.PlayClipAtPoint(powerupaudio[0], transform.position);
	
	// check if collided with the paddle - ie paddle picked up the powerup
	if (col.gameObject.name == "Paddle") {
		// check what powerup am I
		switch(gameObject.name){
			case "Big_Paddle":
			GameObject.Find ("Paddle").transform.localScale += new Vector3(1F, 0, 0);
		break;
			case "More_Points":
			paddleScript.AddPoint (1000);
		break;
        }
		Destroy ( gameObject );
	}
}