using System.Collections; using System.Collections.Generic; using UnityEngine; public class Checkpoint : MonoBehaviour { Animator anim; bool active; // Start is called before the first frame update void Start() { anim = GetComponent(); } // Update is called once per frame void Update() { } private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player" && !active) { AudioManager.instance.Play("Checkpoint"); anim.SetBool("Active", true); Debug.Log("Checkpoint at X" + transform.position.x + " Y" + transform.position.y); collision.GetComponent().checkpoint = transform.position; collision.GetComponent().checkpoint.y += 1; active = true; } } }