// Use this for initialization void Start() { // // ie = ints.GetEnumerator(); // // while(ie.MoveNext()) // { // Debug.Log(ie.Current); // // } // // ie = strings.GetEnumerator(); // while(ie.MoveNext()) // { // Debug.Log(ie.Current); // } // ZombieMaster o = new ZombieMaster("Boss", strings); IEnumerator ie = o.GetEnumerator(); while (ie.MoveNext()) { Debug.Log(ie.Current); } Debug.Log(ZombieMaster.ZombieMasterName); }
// Use this for initialization void Start() { ZombieMaster zombieMaster = new ZombieMaster("bob"); Debug.Log(ZombieMaster.ZombieMasterName); foreach (object obj in zombieMaster) { Debug.Log(obj.ToString()); } }
void Start() { // ZombieMaster is IEnumerable and it has additional properties. You can log its name and iterate through its list of minions. // You can use as many interfaces as you wish. // Interfaces not only tell you what is expected of your class, but also how to get it done. ZombieMaster zombieMaster = new ZombieMaster("bob"); Debug.Log(ZombieMaster.ZombieMasterName); foreach (object obj in zombieMaster) { Debug.Log(obj.ToString()); } }