protected void Update() { foreach (ObjAction ac in waitingToAdd) { actions[ac.GetInstanceID()] = ac; } waitingToAdd.Clear(); foreach (KeyValuePair <int, ObjAction> kv in actions) { ObjAction ac = kv.Value; if (ac.destroy) { watingToDelete.Add(ac.GetInstanceID()); } else if (ac.enable) { ac.Update(); } } foreach (int key in watingToDelete) { ObjAction ac = actions[key]; actions.Remove(key); DestroyObject(ac); } watingToDelete.Clear(); }
public void addAction(GameObject gameObject, ObjAction action, ActionCallback whoToNotify) { action.gameObject = gameObject; action.transform = gameObject.transform; action.whoToNotify = whoToNotify; waitingToAdd.Add(action); action.Start(); }
public void actionDone(ObjAction source) { source.destroy = false; this.currentActionIndex++; if (this.currentActionIndex >= sequence.Count) { this.currentActionIndex = 0; if (repeat > 0) { repeat--; } if (repeat == 0) { this.destroy = true; this.whoToNotify.actionDone(this); } } }
public void actionDone(ObjAction source) { print("actionDone: " + source); }