CGME.Action InstantiateNodes() { List <CGME.Action> actions = new List <CGME.Action>(); //INSTANTIATE int i = 0; foreach (SerialNode node in serial_nodes) { CGME.Action act = CGME.CGFactory.CreateCGInstance(node.type_string) as CGME.Action; act.Read(node.data); actions.Add(act); } foreach (SerialNode node in serial_nodes) { if (node.children_indexes.Count > 0) { //Debug.Log ("3"); if (actions[node.index] is CGME.ActionGroup) { CGME.ActionGroup actiongroup = actions[node.index] as CGME.ActionGroup; foreach (int index in node.children_indexes) { // Debug.Log ("4"); actiongroup.AddAction(actions[index]); } } else if (actions[node.index] is CGME.ActionIfThenElse) { CGME.ActionIfThenElse action_ite = actions[node.index] as CGME.ActionIfThenElse; action_ite.SetIF(actions[node.children_indexes[0]] as CGME.ActionGroup); action_ite.SetTHEN(actions[node.children_indexes[1]] as CGME.ActionGroup); action_ite.SetELSE(actions[node.children_indexes[2]] as CGME.ActionGroup); } } } if (actions.Count > 0) { return(actions[0]); } return(null); }
void AddChild(CGME.ActionGroup parent, CGME.Action child) { parent.AddAction(child); Target.SetSerialize(true); }
public CGME.Action AddAction(CGME.Action act) { CGME_action_root.AddAction(act); return(act); }