protected Node BuildTreeRoot() { Func <bool> PolicemanNotSeeTheFighter = () => (!checkSee(fighter1, policeman)); Func <bool> SeeTheFighter = () => (checkSee(fighter1, policeman) && checkSee(fighter1, heroAgent)); Func <bool> HeroAgentNotSeeTheFighter = () => (!checkSee(fighter1, heroAgent)); Node doChase = new Sequence(new DecoratorInvert(new DecoratorLoop(new LeafAssert(PolicemanNotSeeTheFighter))), new LeafWait(1000), ST_Chase(fighter1, policeman, escapeDestination) ); Node fight = new Sequence(ST_Fight(fighter1), ST_Fight(fighter2), ST_RPunch(fighter2), ST_FaceHitted(fighter1), ST_PickupRightWeapon(fighter1)); Node fight_with_weapon = new DecoratorInvert( new DecoratorLoop( new Sequence( new DecoratorInvert(new LeafAssert(SeeTheFighter)), ST_UseWeapon(fighter1), new DecoratorInvert(new LeafAssert(SeeTheFighter)), ST_HeavyHitted(fighter2) ))); Node doFight = new Sequence(fight, fight_with_weapon); Node doEscape = new Sequence(new DecoratorInvert(new DecoratorLoop(new LeafAssert(HeroAgentNotSeeTheFighter))), fighter1.GetComponent <BehaviorMecanim> ().Node_GoTo(escapeDestination.position, 18f)); Node root = new SequenceParallel(doFight, doChase, doEscape); return(root); }
protected Node BuildTreeRoot() { //Node node1 = new Sequence (new LeafWait (1000), this.Conversation (Daniel, Tom, gatherPoint), new LeafWait(1000)); //Node node2 = new Sequence (new LeafWait(1000), this.ExchangeItem(Daniel, Tom, gatherPoint, ball)); //Node node3 = new Sequence (new LeafWait(1000), this.Follow(Daniel, Tom, Richard)); //Node node4 = new Sequence (new LeafWait(1000), this.Haggling(Daniel, Tom)); // TODO: when does this event happen? price = 7? or what? Node nodeDanielOut = new Sequence(Daniel.GetComponent <BehaviorMecanim> ().ST_PlayHandGesture("THINK", 1000), this.ST_turnonlight(Daniel), this.ST_GetOutHouse(Daniel), this.ST_SetDanielOut(), this.ST_WalkTo(Daniel, fishingPoint), this.ST_LookAT(Daniel, poolCenter)); Node nodeLuren = new SequenceParallel( //this.ST_ThinkUntilClicked (Luren1), this.Conversation(Luren1, Luren2, LurenMeetingPoint12), this.Conversation(Luren3, Luren4, LurenMeetingPoint34), this.Conversation(Luren5, Luren6, LurenMeetingPoint56), this.Conversation(Luren7, Luren8, LurenMeetingPoint78)); //Node nodePolice = new Sequence ( // this.ST_ThinkUntilClicked (police), // this.ChaseBoss ()); Node nodeFish = new DecoratorInvert( new DecoratorLoop( new Sequence( Daniel.GetComponent <BehaviorMecanim> ().ST_PlayHandGesture("Fishing", 1000), new DecoratorInvert(this.ST_Call(Daniel))))); Node nodeConverse = this.ConversationNtimes(Daniel, Tom, gatherPoint, 2); Node nodeSteal = new Sequence(this.WaitUntilDanielLeave(Richard), this.ST_GetInHouse(Richard), this.ST_SetRichardIn(), Richard.GetComponent <BehaviorMecanim> ().ST_PlayFaceGesture("ROAR", 1000), this.ST_GrabObj(Richard, ball), this.ST_GetOutHouse(Richard)); Node nodeChase = this.Chase(Richard, Daniel, Tom, chasePoint1); Node nodeTomCall = new Sequence(this.WaitUntilRichardIn(Tom), this.ST_TomCallDaniel(), new SequenceParallel( Daniel.GetComponent <BehaviorMecanim> ().ST_PlayBodyGesture("Talking On Phone", 1000), Tom.GetComponent <BehaviorMecanim> ().ST_PlayBodyGesture("Talking On Phone", 1000))); Node nodeExchange = new Sequence(new LeafWait(1000), this.ExchangeItem(Richard, PassengerB, dealPoint, ball), this.ST_DropObj(PassengerB, ball)); //Node nodeEnd = new Sequence (this.ST_BallUp (), this.ST_SetGameOver (), this.ST_CheerN (PassengerB, 5)); //Node nodeEnd = new Sequence (this.ST_CheerN (PassengerB, 5), new DecoratorForceStatus(RunStatus.Failure, new LeafWait(1000))); Node doorNode = this.AssertAndWaitForClap(); Node passengerNode = new Sequence( new DecoratorLoop( this.ST_Repeat(Passenger))); Node nodeMonitorUI = this.MonitorUI(); Node nodeMonitorState = this.MonitorState(); Node nodeStory1 = this.NewConverse(); Node nodeStory2 = this.NewPolice(); /*Node root1 = new SequenceParallel ( * new Sequence ( * new SequenceParallel ( * new Sequence (nodeDanielOut, nodeFish), * nodeSteal, * nodeTomCall), * nodeConverse, * nodeChase, * nodeExchange, * this.ST_CheerN(PassengerB, 5)), * doorNode, passengerNode); * * Node nodestory = new DecoratorLoop ( * new DecoratorForceStatus (RunStatus.Success, * new Sequence (nodeStory1, nodeStory2))); * * Node root = new SequenceParallel (root1, * nodeMonitorUI, * nodeMonitorState, * nodestory);*/ /* * Node root = new SequenceParallel ( * new Sequence ( * new SequenceParallel ( * new Sequence (nodeDanielOut, nodeFish), * nodeSteal, * nodeTomCall), * nodeConverse, * nodeChase, * nodeExchange, * this.ST_CheerN(PassengerB, 5)), * doorNode, passengerNode, nodeLuren, nodePolice); */ Node nodePolice1 = new DecoratorLoop( new DecoratorForceStatus(RunStatus.Success, // new SequenceParallel ( new Sequence(this.ST_Repeatpolice(police1, wanderp11, wanderp12)))); Node nodePolice2 = new DecoratorLoop( new DecoratorForceStatus(RunStatus.Success, // new SequenceParallel ( new Sequence(this.ST_Repeatpolice(police2, wanderp21, wanderp22)))); /*Node nodePolice3 = new DecoratorLoop ( * new DecoratorForceStatus (RunStatus.Success, * // new SequenceParallel ( * new Sequence (this.ST_Repeatpolice (police3, wanderp31, wanderp32))));*/ Node nodePolice4 = new DecoratorLoop( new DecoratorForceStatus(RunStatus.Success, // new SequenceParallel ( new Sequence(this.ST_Repeatpolice(police4, wanderp41, wanderp42)))); Node nodePolice5 = new DecoratorLoop( new DecoratorForceStatus(RunStatus.Success, // new SequenceParallel ( new Sequence(this.ST_Repeatpolice(police5, wanderp51, wanderp52)))); //new Sequence (this.ST_Repeatpolice (police2, wanderp21, wanderp22)), //new Sequence (this.ST_Repeatpolice (police3, wanderp31, wanderp32)), //new Sequence (this.ST_Repeatpolice (police4, wanderp41, wanderp42)), //new Sequence (this.ST_Repeatpolice (police5, wanderp51, wanderp52))))); Node Danielcontrol = new DecoratorLoop( new DecoratorForceStatus(RunStatus.Success, new Sequence( this.ST_ThinkUntilClickedLight(Daniel), this.clickLight(Daniel)))); Node root = new SequenceParallel( this.gameOverNew(), Danielcontrol, doorNode, passengerNode, nodeLuren, nodePolice1, nodePolice2, nodePolice4, nodePolice5); return(root); }