using System;
using System.Collections.Generic;
using RebootKit.Engine.Simulation;

namespace RebootKit.Engine.AI {
    public class BehaviourNode {
        public enum Status {
            Success,
            Failure,
            Running
        }
        
        public readonly string Name;
        
        public readonly List<BehaviourNode> Children = new List<BehaviourNode>();

        protected int m_CurrentChild;
        
        public BehaviourNode(string name) {
            Name = name;
        }
        
        public void AddChild(BehaviourNode child) {
            Children.Add(child);
        }

        public virtual Status Process(Actor target, float dt) {
            return Children[m_CurrentChild].Process(target, dt);
        }
        
        public virtual void Reset() {
            m_CurrentChild = 0;

            for (int i = 0; i < Children.Count; i++) {
                Children[i].Reset();
            }
        }
    }

}