void renderCurrentState() { if (actionList2.Count != 0) { if (actionList2[0].getName().Equals("Move")) { iThinkFact obj = actionList2[0].getPreconditions().Find( delegate(iThinkFact fact) { return(fact.getName().Equals("adjacent")); }); if (obj != null) { GameObject lal = obj.getObj(1); Vector3 vector = new Vector3(lal.transform.position.x, this.gameObject.transform.position.y, lal.transform.position.z); iTween.MoveTo(this.gameObject, vector, (float)0.5); } } else if (actionList2[0].getName().Equals("Turn")) { iThinkFact obj = actionList2[0].getPreconditions().Find( delegate(iThinkFact fact) { return(fact.getName().Equals("canTurn")); }); if (obj != null) { Vector3 vector = getCoords(obj.getObj(0), obj.getObj(1)); iTween.RotateBy(this.gameObject, vector, (float)0.5); } } brain.curState = new iThinkState(actionList2[0].applyEffects(brain.curState)); actionList2.RemoveAt(0); } }
void showPlan() { int i = 0; int Counter = 1; GUIStyle style = new GUIStyle(); GUI.Box(new Rect(0, 100, 300, 270), ""); foreach (iThinkAction action in actionList) { if (action.getName().Equals("Move")) { iThinkFact obj = action.getPreconditions().Find( delegate(iThinkFact fact) { return(fact.getName().Equals("npcFacing")); }); if (obj != null) { string lal = "Action No" + Counter + " : Move " + obj.getObj(0).name.ToString(); iThinkAction actio = actionList2.Find( delegate(iThinkAction a){ return(a.Equals(action)); }); if (actio == null) { style.normal.textColor = Color.red; GUI.Label(new Rect(0, 100 + i, 200, 200), lal, style); } else { style.normal.textColor = Color.yellow; GUI.Label(new Rect(0, 100 + i, 200, 200), lal, style); } } } else if (action.getName().Equals("Turn")) { iThinkFact obj = action.getEffects().Find( delegate(iThinkFact fact) { return(fact.getName().Equals("npcFacing") && fact.getPositive()); }); if (obj != null) { string lal = "Action No" + Counter + " : Turn " + obj.getObj(0).name.ToString(); iThinkAction actio = actionList2.Find( delegate(iThinkAction a){ return(a.Equals(action)); }); if (actio == null) { style.normal.textColor = Color.red; GUI.Label(new Rect(0, 100 + i, 200, 200), lal, style); } else { style.normal.textColor = Color.yellow; GUI.Label(new Rect(0, 100 + i, 200, 200), lal, style); } } } else if (action.getName().Equals("PickUp")) { iThinkFact obj = action.getEffects().Find( delegate(iThinkFact fact) { return(fact.getName().Equals("npcHolding")); }); if (obj != null) { string lal = "Action No" + Counter + " : PickUp " + obj.getObj(0).name.ToString(); iThinkAction actio = actionList2.Find( delegate(iThinkAction a){ return(a.Equals(action)); }); if (actio == null) { style.normal.textColor = Color.red; GUI.Label(new Rect(0, 100 + i, 200, 200), lal, style); } else { style.normal.textColor = Color.yellow; GUI.Label(new Rect(0, 100 + i, 200, 200), lal, style); } } } else if (action.getName().Equals("Shoot")) { string lal = "Action No" + Counter + " : Shoot "; iThinkAction actio = actionList2.Find( delegate(iThinkAction a){ return(a.Equals(action)); }); if (actio == null) { style.normal.textColor = Color.red; GUI.Label(new Rect(0, 100 + i, 200, 200), lal, style); } else { style.normal.textColor = Color.yellow; GUI.Label(new Rect(0, 100 + i, 200, 200), lal, style); } } else { string lal = "Action No" + Counter + " : Stab "; iThinkAction actio = actionList2.Find( delegate(iThinkAction a){ return(a.Equals(action)); }); if (actio == null) { style.normal.textColor = Color.red; GUI.Label(new Rect(0, 100 + i, 200, 200), lal, style); } else { style.normal.textColor = Color.yellow; GUI.Label(new Rect(0, 100 + i, 200, 200), lal, style); } } i += 30; Counter++; } }