//Default NPC public HumanSave() { layer = 0; Name = "Veronica"; tag = "NPC"; xloc = 0.0f; yloc = 0.0f; zloc = 0.0f; xrot = 0.0f; yrot = 0.0f; zrot = 0.0f; type = EntityOfType.Human; taskBacklog = new List <taskNode>(); reactiveContainer = new List <taskNode>(); currentTask = new taskNode(); nextUpdate = 0.0f; lastUpdate = new DateTime(); updateRequired = false; gender = Gender.Female; Sadness_Joy = 50.0f; SadnessMod = 0.0f; JoyMod = 0.0f; Anticipation_Surprise = 50.0f; AnticipationMod = 0.0f; SurpriseMod = 0.0f; Disgust_Trust = 50.0f; DisgustMod = 0.0f; TrustMod = 0.0f; Fear_Anger = 50.0f; FearMod = 0.0f; AngerMod = 0.0f; SJLower = 0.0f; SJLowerLimit = 0.0f; SJUpper = 0.0f; SJUpperLimit = 100.0f; ASLower = 0.0f; ASLowerLimit = 0.0f; ASUpper = 0.0f; ASUpperLimit = 100.0f; DTLower = 0.0f; DTLowerLimit = 0.0f; DTUpper = 0.0f; DTUpperLimit = 100.0f; FALower = 0.0f; FALowerLimit = 0.0f; FAUpper = 0.0f; FAUpperLimit = 100.0f; setStage = 0; }
//Current task has been completed, get next task if there are any (LIFO) public void completeTask() { //There are tasks in backlog if (taskBacklog.Count > 0) { //Returns the most recently added task int lastTask = (taskBacklog.Count - 1); currentTask = taskBacklog[lastTask]; taskBacklog.RemoveAt(lastTask); } //Completed all tasks, none in backlog else { taskNode copy = new taskNode(-1, 0); currentTask = copy; } }
public taskNode currentTask; //The current task the entity is actively persuing, -1 task identifier for empty //Pushes a task onto either currentTask or taskBacklog depending on priority public void pushTask(taskNode task) { //current task is not empty (-1 means empty) if (currentTask.taskIdentifier != -1) { //not as important as current task if (task.priority < currentTask.priority) { taskBacklog.Add(task); } //more important else { taskBacklog.Add(currentTask); currentTask = task; } } //No tasks currently else { currentTask = task; } }
//Init function for brand new task controller public EntityTaskController() { taskBacklog = new List <taskNode>(); reactiveContainer = new List <taskNode>(); currentTask = new taskNode(-1, 0); }
//Init function for task controller using data, (loading old task controller) public EntityTaskController(HumanSave load) { taskBacklog = load.taskBacklog; reactiveContainer = load.reactiveContainer; currentTask = load.currentTask; }