Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / AI / Navmesh / Conditions / AndCondition.cs
@Rackday Rackday on 21 Aug 677 bytes Project Added
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; 
    }
}