Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / AI / Navmesh / Conditions / AndCondition.cs
@Rackday Rackday on 21 Aug 677 bytes Project Added
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. [CreateAssetMenu(menuName = "Finite State Machine/Condition/And Condition")]
  5. public class AndCondition : Condition
  6. {
  7. public List<Condition> andConditions;
  8. protected override bool Test(FiniteStateMachine fsm)
  9. {
  10. bool result = false;
  11. if (andConditions != null)
  12. {
  13. foreach (Condition condition in andConditions)
  14. {
  15. result = (condition != null && condition.DoTest(fsm));
  16. if (!result)
  17. {
  18. break;
  19. }
  20. }
  21. }
  22. return result;
  23. }
  24. }