void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "Jump") { gameObject.GetComponent <Rigidbody2D>().velocity = new Vector2(0, 1) * jumpForce; } if (col.gameObject.tag == "Trampoline") { gameObject.GetComponent <Rigidbody2D>().velocity = -gameObject.GetComponent <Rigidbody2D>().velocity *trampolineForce; } if (col.gameObject.tag == "Append") { Instantiate(environment, new Vector3(startpos.x + 6.5f, startpos.y, startpos.z), transform.rotation); } if (col.gameObject.tag == "Destroy") { reset.Reset(); reset = environment.GetComponent <MainMenuReset>(); } }
// Use this for initialization void Start() { startpos = environment.transform.position; reset = environment.GetComponent <MainMenuReset>(); }