- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class ConditionCkecker : MonoBehaviour
- {
- [SerializeField]
- private List<Triggers> conditionsAND;
- [SerializeField]
- private List<Triggers> conditionsOR;
- public bool CheckConditions()
- {
-
- if (AND() && OR()) return true;
- return false;
- }
- public bool AND()
- {
- if (conditionsAND.Count > 0)
- {
- foreach (Triggers t in conditionsAND)
- {
- if (!t.active)
- {
- return false;
- }
- }
- return true;
- } else return true;
-
- }
- private bool OR()
- {
-
- if (conditionsOR.Count > 0)
-
- {
- foreach (Triggers t in conditionsOR)
- {
- if (t.active)
- {
- return true;
- }
- }
- return false;
- }
- else return true;
- }
-
- }