public void OnCollisionEnter2D(Collision2D col) { SwitchBehavior sb = col.collider.GetComponent <SwitchBehavior>(); PlayerBehavior pb = col.collider.GetComponent <PlayerBehavior>(); //print(col.collider.gameObject.name); if (sb != null) { audioMan.playClipHere("hit", transform.position); //print("in there bois"); sb.hitMe(); } else if (pb != null) { pb.onDeath(); } else if (playSound) { audioMan.playClipHere("miss", transform.position); //print("no switch on collider"); } if (destroyOnHit) { GameObject.Destroy(this.gameObject); } }
public void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.GetComponent <GunBehavior>() != null) { ready = true; audio.playClipHere("complete", transform.position); audio.stopMusic(); } }
public void remoteJump(Vector2 dir) { audioManager.playClipHere("jump", transform.position); rb2.AddForce(dir * jumpForce, ForceMode2D.Impulse); }