void OnTriggerStay2D(Collider2D col) { // if something collides and stays, mark it as a potential thing to be launched (launchee) if (col.gameObject.tag == "canmovepulley" || col.gameObject.tag == "Player") { launchee = col.gameObject; //Debug.Log ("Launchee: " + col.gameObject.name); rocksLever = launchee.GetComponent <lever> (); rb = launchee.GetComponent <Rigidbody2D> (); } //working on this }
void Start() //don't render switch objects by default { sprite_renderer = gameObject.GetComponent <SpriteRenderer>(); sprite_renderer.enabled = false; box = gameObject.GetComponent <BoxCollider2D> (); box.enabled = false; //ATTENTION TROGLODYTES: If making a new switch, create a new file obs_toggle_X, where X is the new letter. //Then copy-paste this and change the letter below so it matches your new switch. //Make sure all your obs for the new switch use this script, and not one for a diff switch. lever = GameObject.Find("lever_b"); script = (lever)lever.GetComponent(typeof(lever)); }
// Use this for initialization void Start() { leverclass = this.gameObject.GetComponent <lever> (); }