Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / AI / Navmesh / Conditions / OrCondition.cs
@Rackday Rackday on 21 Aug 678 bytes Project Added
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(menuName = "Finite State Machine/Condition/Or Condition")]
public class OrCondition : Condition
{
    public List<Condition> orConditions;
    protected override bool Test(FiniteStateMachine fsm)
    {

        bool result = false;
        if (orConditions != null)
        {
            foreach (Condition condition in orConditions)
            {
                result = (condition != null && condition.DoTest(fsm));
                if (result)
                {
                    return true;
                }
            }
        }
        return false;


        
    }
}