- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- [CreateAssetMenu(menuName = "Finite State Machine/Condition/And Condition")]
- public class AndCondition : Condition
- {
- public List<Condition> andConditions;
- protected override bool Test(FiniteStateMachine fsm)
- {
-
- bool result = false;
- if (andConditions != null)
- {
- foreach (Condition condition in andConditions)
- {
- result = (condition != null && condition.DoTest(fsm));
- if (!result)
- {
- break;
- }
- }
- }
- return result;
- }
- }