Ejemplo n.º 1
0
 public void SetCP(CheckPointBehaviour cp)
 {
     if (curr_cp == null || cp.index >= curr_cp.index)
     {
         curr_cp = cp;
     }
 }
    void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag("Player"))
        {
            RespawnableObject playerRespawn = collision.GetComponent <RespawnableObject>();

            if (playerRespawn)
            {
                playerRespawn.RespawnPosition = transform.position;
            }

            if (enableOnce)
            {
                GetComponent <Collider2D>().enabled = false;
            }

            if (LastCheckpoint)
            {
                LastCheckpoint.Deactivate();
            }

            LastCheckpoint = this;

            Activate();
        }
    }