Game Development Reference
In-Depth Information
18 //Return the next wizard
19 return (CurrentObj != null);
20 }
21 //----------------------------------------------------
22 //Resets the iterator back to the first wizard
23 public void Reset()
24 {
25 CurrentObj = null;
26 }
27 //----------------------------------------------------
28 //C# Property to get current wizard
29 public object Current
30 {
31 get{return CurrentObj;}
32 }
33 //----------------------------------------------------
34 }
35 //----------------------------------------------------
36 //Sample class defining a wizard object
37 //Derives from IEnumerable, allowing looping with foreach
38 [System.Serializable]
39 public class Wizard : MonoBehaviour, IEnumerable
40 {
41 //----------------------------------------------------
42 //Reference to last created wizard
43 public static Wizard LastCreated = null;
44
45 //Reference to first created wizard
46 public static Wizard FirstCreated = null;
47
48 //Reference to next wizard in the list
49 public Wizard NextWizard = null;
50
51 //Reference to previous wizard in the list
52 public Wizard PrevWizard = null;
53
54 //Name of this wizard
55 public string WizardName = "";
56 //----------------------------------------------------
57 //Constructor
58 void Awake()
59 {
60 //Should we update first created
61 if(FirstCreated==null)
 
Search WWH ::




Custom Search