public void Awake() { brain = new iThinkBrain(); // Sensing GameObjects List<String> tags = new List<String>(); tags.Add( "direction" ); tags.Add( "location" ); tags.Add( "player" ); tags.Add( "npc" ); tags.Add( "gun" ); tags.Add( "knife" ); brain.sensorySystem.OmniscientUpdate( this.gameObject, tags ); Debug.LogWarning( "knownObjects count: " + brain.sensorySystem.getKnownObjects().Count ); // Building knowledge SimplegameTest(); brain.curState = brain.startState; // Building Actions from knowledge brain.ActionManager = new iThinkActionManager(); brain.ActionManager.initActionList( this.gameObject, schemaList, brain.getKnownObjects(), brain.startState.getFactList() ); // Init search letsPlay = false; giveMeHint = false; resetEve = false; brain.planner.forwardSearch( brain.curState, brain.goalState, brain.ActionManager); brain.planner.getPlan().debugPrintPlan(); actionList = brain.planner.getPlan().getPlanActions(); actionList2 = new List<iThinkAction>(actionList); initPosition = new Vector3(this.gameObject.transform.position.x,this.gameObject.transform.position.y,this.gameObject.transform.position.z); }
private void renderCurrentState() { int i; BitArray stacks = new BitArray(brain.getKnownObjects().Count); foreach (iThinkFact fact in brain.curState.getFactList()) { if (fact.getName().Equals("onTable")) { i = findNextFreeStack(stacks); fact.getObj(0).transform.position = new Vector3((float)(1.5 - i * 1.5), 0, 0); stacks.Set(i - 1, true); } } foreach (iThinkFact fact in brain.curState.getFactList()) { if (fact.getName().Equals("on")) { fact.getObj(0).transform.position = fact.getObj(1).transform.position; fact.getObj(0).transform.Translate(0, (float)1.5, 0); } else if (fact.getName().Equals("holding")) { fact.getObj(0).transform.position = new Vector3(-15, 5, 0); } } }
public void Awake() { brain = new iThinkBrain(); // Sensing GameObjects List <String> tags = new List <String>(); tags.Add("direction"); tags.Add("location"); tags.Add("player"); tags.Add("npc"); tags.Add("gun"); tags.Add("knife"); brain.sensorySystem.OmniscientUpdate(this.gameObject, tags); Debug.LogWarning("knownObjects count: " + brain.sensorySystem.getKnownObjects().Count); // Building knowledge SimplegameTest(); brain.curState = brain.startState; // Building Actions from knowledge brain.ActionManager = new iThinkActionManager(); brain.ActionManager.initActionList(this.gameObject, schemaList, brain.getKnownObjects(), brain.startState.getFactList()); // Init search letsPlay = false; giveMeHint = false; resetEve = false; brain.planner.forwardSearch(brain.curState, brain.goalState, brain.ActionManager); brain.planner.getPlan().debugPrintPlan(); actionList = brain.planner.getPlan().getPlanActions(); actionList2 = new List <iThinkAction>(actionList); initPosition = new Vector3(this.gameObject.transform.position.x, this.gameObject.transform.position.y, this.gameObject.transform.position.z); }
public void Awake() { brain = new iThinkBrain(); // Sensing GameObjects List<String> tags = new List<String>(); tags.Add( "block" ); brain.sensorySystem.OmniscientUpdate( this.gameObject, tags ); // Building knowledge initKnowledge(); brain.curState = brain.startState; // Generate actions from knowledge brain.ActionManager = new iThinkActionManager(); brain.ActionManager.initActionList( this.gameObject, schemaList, brain.getKnownObjects(), brain.getKnownFacts() ); // Init search renderCurrentState(); brain.planner.forwardSearch( brain.startState, brain.goalState, brain.ActionManager ); }
public void Awake() { brain = new iThinkBrain(); // Sensing GameObjects List <String> tags = new List <String>(); tags.Add("block"); brain.sensorySystem.OmniscientUpdate(this.gameObject, tags); // Building knowledge initKnowledge(); brain.curState = brain.startState; // Generate actions from knowledge brain.ActionManager = new iThinkActionManager(); brain.ActionManager.initActionList(this.gameObject, schemaList, brain.getKnownObjects(), brain.getKnownFacts()); // Init search renderCurrentState(); brain.planner.forwardSearch(brain.startState, brain.goalState, brain.ActionManager); }
//initialize brain, state and goal public void brainInit() { brain = new iThinkBrain(); //find all game objects by tags tags = new List <string>(); tags.Add("forest"); tags.Add("mine"); tags.Add("factory"); //tags.Add("warehouse"); //tags.Add("windmill"); tags.Add("lumberjack"); tags.Add("magicTower"); tags.Add("object"); tags.Add("animal"); tags.Add("resource"); tags.Add("weapon"); tags.Add("tool"); tags.Add("laboratory"); tags.Add("armory"); tags.Add("market"); tags.Add("lake"); tags.Add("fishingPole"); //tags.Add("townhall"); tags.Add("temple"); tags.Add("barracks"); tags.Add("district"); tags.Add("repository"); //tags.Add("slaughterhouse"); brain.sensorySystem.OmniscientUpdate(this.gameObject, tags); brain.startState = new iThinkState("Initial", new List <iThinkFact>()); brain.goalState = new iThinkState("Goal", new List <iThinkFact>()); initKnowledge(); initGoal(); brain.curState = new iThinkState(brain.startState); brain.ActionManager = new iThinkActionManager(); brain.ActionManager.initActionList(this.gameObject, actionSchemas, brain.getKnownObjects(), brain.getKnownFacts()); }
//update action manager, when new objects enter the domain or other ones are removed from it public void updateActionManagers() { brain.ActionManager = new iThinkActionManager(); brain.ActionManager.initActionList(this.gameObject, actionSchemas, brain.getKnownObjects(), brain.getKnownFacts()); //printActions(); }
//initialize brain, state and goal public void brainInit() { brain = new iThinkBrain(); //find all game objects by tags tags = new List<string>(); tags.Add("forest"); tags.Add("mine"); tags.Add("factory"); //tags.Add("warehouse"); //tags.Add("windmill"); tags.Add("lumberjack"); tags.Add("magicTower"); tags.Add("object"); tags.Add("animal"); tags.Add("resource"); tags.Add("weapon"); tags.Add("tool"); tags.Add("laboratory"); tags.Add("armory"); tags.Add("market"); tags.Add("lake"); tags.Add("fishingPole"); //tags.Add("townhall"); tags.Add("temple"); tags.Add("barracks"); tags.Add("district"); tags.Add("repository"); //tags.Add("slaughterhouse"); brain.sensorySystem.OmniscientUpdate( this.gameObject, tags ); brain.startState = new iThinkState("Initial", new List<iThinkFact>()); brain.goalState = new iThinkState("Goal", new List<iThinkFact>()); initKnowledge(); initGoal(); brain.curState = new iThinkState(brain.startState); brain.ActionManager = new iThinkActionManager(); brain.ActionManager.initActionList( this.gameObject, actionSchemas, brain.getKnownObjects(), brain.getKnownFacts() ); }