IEnumerator PerformingActions(AIAction behaviour) { for (int i = 0; i < behaviour.actions.Length; i++) { lastCoroutine = StartCoroutine(behaviour.actions[i].perform(this)); yield return(lastCoroutine); } actualAction = -2; yield return(new WaitForSeconds(cooldown)); actualAction = -1; acting = false; }
void addAction(JsonData action) { Array.Resize <AIAction>(ref actions, actions.Length + 1); int actionID = actions.Length - 1; actions[actionID] = new AIAction(); actions[actionID].relevance = (int)action["relevance"]; actions[actionID].name = action["name"].ToString(); actions[actionID].open = (bool)action["open"]; actions[actionID].color = new Color((int)action["color"]["r"] / 255f, (int)action["color"]["g"] / 255f, (int)action["color"]["b"] / 255f, (int)action["color"]["a"] / 255f); actions[actionID].isAndGroup = (bool)action["isAndGroup"]; actions[actionID].prioritary = (bool)action["prioritary"]; actions[actionID].continuosRun = (bool)action["continuosRun"]; addConditions(action["conditions"], actionID); addActionExecutions(action["actions"], actionID); }