/*new progress function, where only the positive effects of actions will be applied */ public iThinkPlan progressPositive(iThinkPlan Step, iThinkAction Action) { iThinkPlan NewStep = new iThinkPlan(Step); List <iThinkAction> curActions; curActions = NewStep.getPlanActions(); curActions.Add(Action); NewStep.setState(Action.applyPositiveEffects(Step.getState())); return(NewStep); }
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++; } }
/*new progress function, where only the positive effects of actions will be applied */ public iThinkPlan progressPositive( iThinkPlan Step, iThinkAction Action ) { iThinkPlan NewStep = new iThinkPlan( Step ); List<iThinkAction> curActions; curActions = NewStep.getPlanActions(); curActions.Add( Action ); NewStep.setState( Action.applyPositiveEffects( Step.getState() ) ); return NewStep; }