#pragma strict var speed : float = 9.0; var horizontalInput : float; var verticalInput : float; var points : int=0; function Start () { } function Update () { horizontalInput = Input.GetAxis("Horizontal")*speed; horizontalInput *= Time.deltaTime; verticalInput = Input.GetAxis("Vertical")*speed; verticalInput *= Time.deltaTime; if ((horizontalInput != 0) || (verticalInput != 0)) // if request to move transform.Translate(horizontalInput,0,verticalInput,Space.World); } function OnTriggerEnter (mycollider:Collider) { if (mycollider.gameObject.name=="InvisiblePill") { //Debug.Log("COLISION!!!!!!!!!"); Destroy(mycollider.gameObject); renderer.enabled=false; yield WaitForSeconds (5); renderer.enabled=true; } if (mycollider.gameObject.name=="BoxOfLife") { //Debug.Log("COLISION!!!!!!!!!"); audio.Play(); yield WaitForSeconds (1); Destroy(mycollider.gameObject); points++; Debug.Log("Player has "+points+" points"); } }