void OnCollisionEnter2D(Collision2D coll) //this portion of the code is what happens when Steve collides with the item // you will have to customize it to act according to the power-up or power-down { if (coll.gameObject.tag == "Player") { BouncerSound sound = GameObject.FindObjectOfType(typeof(BouncerSound)) as BouncerSound; sound.TriggerSound(); extraBouncer bouncer = GameObject.FindObjectOfType(typeof(extraBouncer)) as extraBouncer; bouncer.activate(); Destroy(gameObject); } }
void OnCollisionEnter2D(Collision2D coll) //this portion of the code is what happens when Steve collides with the item // you will have to customize it to act according to the power-up or power-down { if (coll.gameObject.tag == "Player") { BouncerSound sound = GameObject.FindObjectOfType(typeof(BouncerSound)) as BouncerSound; sound.TriggerSound(); MoveScript[] bouncers = FindObjectsOfType <MoveScript>(); bouncers[0].fastSpeed(); bouncers[1].fastSpeed(); bouncers[2].fastSpeed(); Destroy(gameObject); } }
public int OnCollisionEnter2D(Collision2D coll) { if (canTakeDamage && coll.gameObject.tag == "bouncer") { hp = hp - 1; ShakeScript cam = GameObject.FindObjectOfType(typeof(ShakeScript)) as ShakeScript; cam.TriggerShake(); StartCoroutine(damageTimer()); StartCoroutine(Flasher()); BouncerSound sound = GameObject.FindObjectOfType(typeof(BouncerSound)) as BouncerSound; sound.TriggerSound(); } return(hp); }