private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.layer == 8) { isJumping = false; anim.SetBool("isJump", false); } if (collision.gameObject.layer == 16) { isJumping = false; anim.SetBool("isJump", false); } if (collision.gameObject.tag == "checkpoint") { posInitial = collision.gameObject.transform.position; //pega a posição do player ao passar no checkpoint transform.position = posInitial; //Destroy(collision.gameObject); } if (collision.gameObject.layer == 10) { Controller.current.RemoveLife(1); gcc = GameObject.FindGameObjectWithTag("GC").GetComponent <GameControllerCheck>(); transform.position = gcc.LastCheckpoint; } }
void Start() { LastCheckpoint = new Vector2(-12.89f, -1.37f); if (instance == null) { instance = this; } else { Destroy(gameObject); } }
void Start() { anim = gameObject.GetComponent <Animator>(); GC = GameObject.FindGameObjectWithTag("GC").GetComponent <GameControllerCheck>(); //encontra o objeto na cena com a tag "GC" platform = GameObject.FindGameObjectWithTag("PlatformDown"); }