//============= Copyright (c) Ludic GmbH, All rights reserved. ============== // // Purpose: Part of the My Behaviour Tree Code // //============================================================================= using System.Collections; using System.Collections.Generic; using UnityEngine; namespace MyBT { [System.Serializable] public class TokenList : IEnumerator, IEnumerable { [SerializeField] List array = new List(); public Token this[int param] { get { if (param < array.Count) return array[param]; return null; } set { array[param] = value; } } public int Count { get { return array.Count; } } public void Add(Token t) { array.Add(t); } public IEnumerator GetEnumerator() { return (IEnumerator)this; } int position = -1; public bool MoveNext() { position++; return (position < array.Count); } public void Reset() { position = -1; } public object Current { get { return array[position]; } } } }