#pragma strict public var scoreText: GameObject; var spawnPoints:Transform[]; //var rigidbody: Rigidbody; //var ballObj: Rigidbody; public var ballObject: Rigidbody; var spawnNum:int; var ballNum:int; public var myTimer : float = 15.0; public var score: int = 0; var SpawnScript: Spawn2;//.GetComponent(Spawn2); //public var proj = Spawn2.proj; function Start () { scoreText = GameObject.Find(“scoreText”); SpawnScript = GameObject.Find(“Main Camera”).GetComponent(Spawn2); print(Spawn2); Destroy(gameObject,15); SpawnScript.LosePoints(); } function OnCollisionEnter(col:Collision) { if(col.gameObject.tag == “Player”) { print(col.rigidbody); scoreText = GameObject.Find(“scoreText”); SpawnScript = GameObject.Find(“Main Camera”).GetComponent(Spawn2); //audio.PlayOneShot(goodSound); Destroy(rigidbody); score += 10; } }

#pragma strict public var spawnPoints:Transform[]; //var rigidbody: Rigidbody; //var ballObj: Rigidbody; public var ballObjects: Rigidbody[]; public var myTimer : float = 15.0; public var score: int = 0; public var spawnNum:int; public var ballNum:int; public var scoreText:GUIText; public var scoreText2:GUIText; scoreText.guiText.text = “You have jack shit”; scoreText2.guiText.text = “You have jack shit”; public var proj: Rigidbody; var goodSound: AudioClip; function Start() { //spawnPoint = GameObject.FindGameObjectsWithTag(“Spawn”); //ballObject = GameObject.FindGameObjectsWithTag(“BallObject”); } function Update() { if(myTimer > 0){ myTimer -= Time.deltaTime; } if(myTimer <= 0){ spawnNum =Random.Range(0, spawnPoints.length-1); ballNum = Random.Range(0, ballObjects.length-1); print(“spawnpoint:” + spawnNum + ”  ball number:” + ballNum); var proj: Rigidbody = Instantiate(ballObjects[ballNum], spawnPoints[spawnNum].position, spawnPoints[spawnNum].rotation); proj.velocity = Vector3(-25,0,0); proj.AddForce(Vector3(-40,50,0)); myTimer = 15.0; } if (score == 100) { scoreText.guiText.text = “You have won the game!”; } if (score == -100) { scoreText.guiText.text = “You lose! Try again… Harder this time!”; } } function OnCollisionEnter(col:Collision) { //if(col.gameObject.tag == “Player”) { print(col.rigidbody); //scoreText = GameObject.Find(“scoreText”); //SpawnScript = GameObject.Find(“Main Camera”).GetComponent(Spawn2); audio.PlayOneShot(goodSound); Destroy(rigidbody); score += 10; } //} function LosePoints(){ […]