public void CreateTask(GameObject target, ActionType type, int roundLimit) { Action action = new ActionOnObject(gameObject, target, type, roundLimit); AddTask(action); FindObjectOfType <TaskQueuePanelControl>().AddActionItemToDisplay(action); }
void UnloadResources() { foreach (ResourceTypes type in heldResources.Keys) { int remainingCapacity = resourceManager.RemainingCapacity(type); resourceManager.AddResource(type, heldResources[type].amount); heldResources[type].AddResource(-Math.Min(remainingCapacity, heldResources[type].amount)); ActionOnObject currentAction = taskManager.taskInProgress as ActionOnObject; if (currentAction != null) { if (resourceManager.RemainingCapacity(type) == 0) { currentAction.roundsFinished = currentAction.maxRounds; } else { currentAction.roundsFinished++; } } } }