Added auto-save

This commit is contained in:
Gerard Gascón 2022-10-10 23:32:15 +02:00 committed by GitHub
parent 09973676e1
commit 8857a11038
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 206 additions and 21 deletions

View file

@ -5,6 +5,7 @@ namespace SimpleTools.Cinemachine {
public class CMCameraTrigger : MonoBehaviour {
CinemachineVirtualCamera vcam;
[SerializeField, Tooltip("Name of the collider's tag that will trigger the camera.")] string triggerTagName;
void Awake() {
vcam = GetComponentInChildren<CinemachineVirtualCamera>(true);
@ -13,12 +14,12 @@ namespace SimpleTools.Cinemachine {
#region 3D
void OnTriggerEnter(Collider col) {
if (col.CompareTag("Player")) {
if (col.CompareTag(triggerTagName)) {
vcam.gameObject.SetActive(true);
}
}
void OnTriggerExit(Collider col) {
if (col.CompareTag("Player")) {
if (col.CompareTag(triggerTagName)) {
vcam.gameObject.SetActive(true);
}
}
@ -26,12 +27,12 @@ namespace SimpleTools.Cinemachine {
#region 2D
void OnTriggerEnter2D(Collider2D col) {
if (col.CompareTag("Player")) {
if (col.CompareTag(triggerTagName)) {
vcam.gameObject.SetActive(true);
}
}
void OnTriggerExit2D(Collider2D col) {
if (col.CompareTag("Player")) {
if (col.CompareTag(triggerTagName)) {
vcam.gameObject.SetActive(false);
}
}