-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTriggerList.cs
More file actions
31 lines (25 loc) · 748 Bytes
/
TriggerList.cs
File metadata and controls
31 lines (25 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public enum Indicator { Start, Platformer, Combat, Time };
public class TriggerList : MonoBehaviour
{
[SerializeField] private Indicator type;
[SerializeField] private int level = 1;
[SerializeField] private bool setInactive;
public event Action OnTimeCollect;
public event Action<Indicator> OnLevelTrigger;
private void OnTriggerEnter(Collider collider)
{
if (type == Indicator.Time)
OnTimeCollect?.Invoke();
else
GameManager.instance.LoadLevel((int)type);
if (setInactive)
{
gameObject.SetActive(false);
}
}
}