20 lines
546 B
C#
20 lines
546 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class CheckPoint : MonoBehaviour{
|
|
|
|
public Transform checkpointPos;
|
|
|
|
void OnTriggerEnter2D(Collider2D col){
|
|
if (col.CompareTag("Player")){
|
|
col.GetComponent<PlayerController>().lastCheckpoint = checkpointPos.position;
|
|
}
|
|
}
|
|
|
|
void OnDrawGizmos(){
|
|
Gizmos.color = Color.green;
|
|
BoxCollider2D col = GetComponent<BoxCollider2D>();
|
|
Gizmos.DrawWireCube(col.transform.position, col.size);
|
|
}
|
|
}
|