예제 #1
0
    protected Node GetDrink(SmartCharacter user)
    {
        return new Sequence(
            user.Node_Require(StateName.RoleActor, StateName.IsStanding, ~StateName.RightHandOccupied, ~StateName.IsIncapacitated),
            this.Node_Require(StateName.RoleDispenser),
            user.Node_GoTo(this.StandPoint.position),
            user.Node_OrientTowards(this.DrinkButton.transform.position),
            new DecoratorCatch(
                () => //if terminates, make sure the right hand interaction and headlook is stopped
                {
                    user.Character.StopInteraction(FullBodyBipedEffector.RightHand);
                    user.Character.HeadLookStop();
                },
                new Sequence(
                    user.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.DrinkButton),
                    user.Node_WaitForTrigger(FullBodyBipedEffector.RightHand),
                    new SequenceParallel(
                        //user.Node_HeadLook(this.DrinkPickup.transform.position),
                        user.Node_OrientTowards(this.DrinkPickup.transform.position)),
                    user.Node_StopInteraction(FullBodyBipedEffector.RightHand),
                    new LeafWait(1000),
                    new LeafInvoke(() => GenerateDrink()),
                    new LeafWait(500))),
            user.ST_Pickup(DrinkHolder, DrinkPickup),
            user.Node_Set(StateName.HoldingDrink, StateName.RightHandOccupied),
            user.Node_GoTo(this.LeavePoint.position));

    }
예제 #2
0
 protected Node GetTicket(SmartCharacter user)
 {
     return new Sequence(
         new LeafInvoke(() => GenerateTicket()),
         user.Node_GoTo(StandPoint.position),
         user.Node_OrientTowards(TicketHolder.transform.position),
         user.ST_Pickup(TicketHolder, InteractionTake),
         new DecoratorCatch(
             () => GameObject.Destroy(user.HoldPropRightHand.CurrentProp.gameObject),
             user.Node_GoTo(rect.RandomPoint(GoToEdge1.position.y))),
         new LeafInvoke(() => GameObject.Destroy(user.HoldPropRightHand.CurrentProp.gameObject)));
 }
예제 #3
0
 protected Node FillOutForm(SmartCharacter user)
 {
     Vector3 oldPosition = new Vector3();
     return new Sequence(
         user.Node_Require(StateName.RoleActor, StateName.IsStanding, ~StateName.IsIncapacitated, ~StateName.RightHandOccupied),
         this.Node_Require(StateName.RoleTable, ~StateName.HoldingBall, ~StateName.HoldingWallet),
         new LeafInvoke(() => oldPosition = user.transform.position),
         new Race(
             new Sequence(
                 new LeafWait(15000),
                 new LeafInvoke(() => RunStatus.Failure)),
             user.ST_StandAtWaypoint(this.StandPoint)),
         user.Node_NudgeTo(Val.V(() => this.StandPoint.position)),
         new LeafInvoke(() => user.transform.rotation = this.StandPoint.rotation),
         new LeafInvoke(() => user.HoldPropRightHand.Attach(user.HoldPropHidden.Release())),
         new LeafInvoke(() => user.GetRightProp().FadeIn()),
         user.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.PropPickup),
         user.Node_WaitForTrigger(FullBodyBipedEffector.RightHand),
         new LeafInvoke(() => this.PropHolder.Attach(user.HoldPropRightHand.Release())),
         user.Node_StopInteraction(FullBodyBipedEffector.RightHand),
         user.Behavior.ST_PlayHandGesture("writing", 6000),
         user.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.PropPickup),
         user.Node_WaitForTrigger(FullBodyBipedEffector.RightHand),
         new LeafInvoke(() => user.HoldPropRightHand.Attach(this.PropHolder.Release())),
         user.Node_StopInteraction(FullBodyBipedEffector.RightHand),
         new LeafWait(500),
         new LeafInvoke(() => user.GetRightProp().FadeOut()),
         new LeafWait(500),
         new LeafInvoke(() => user.HoldPropHidden.Attach(user.HoldPropRightHand.Release())),
         user.Node_GoTo(Val.V(() => oldPosition)));
 }
예제 #4
0
 protected Node Attend(SmartCharacter user)
 {
     return new Sequence(
         user.Node_GoTo(TellerStandPoint.position),
         user.Node_OrientTowards(CustomerStandPoint.position),
         user.Node_Set(StateName.IsImmobile),
         user.Node_Set(this.Id, RelationName.IsAttending),
         this.Node_Set(StateName.IsOccupied));
 }
예제 #5
0
 /// <summary>
 /// Subtree for the user switching the lamp on/off.
 /// </summary>
 /// <param name="switchTo">THe desired state of StateName.IsTurnedOn after executing the tree.</param>
 private Node ST_Switch(SmartCharacter user, StateName switchTo)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, StateName.IsStanding),
         this.Node_Require(StateName.RoleTelevision, ~switchTo),
         user.Node_GoTo(turnOnOffStandPoint.position),
         user.Node_OrientTowards(onOffSwitch.transform.position),
         user.Node_StartInteraction(FullBodyBipedEffector.LeftHand, onOffSwitch),
         user.Node_WaitForTrigger(FullBodyBipedEffector.LeftHand),
         user.Node_StopInteraction(FullBodyBipedEffector.LeftHand),
         this.Node_Set(switchTo)
         );
 }
예제 #6
0
 /// <summary>
 /// Subtree for the user switching the lamp on/off.
 /// </summary>
 /// <param name="switchTo">THe desired state of StateName.IsTurnedOn after executing the tree.</param>
 private Node ST_Switch(SmartCharacter user, StateName switchTo)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, StateName.IsStanding),
         this.Node_Require(StateName.RoleLamp, ~switchTo),
         user.Node_GoTo(standPoint.position),
         user.Node_OrientTowards(lightSwitch.transform.position),
         user.Node_StartInteraction(FullBodyBipedEffector.RightHand, lightSwitch.interactionObject),
         user.Node_WaitForFinish(FullBodyBipedEffector.RightHand),
         user.Node_StopInteraction(FullBodyBipedEffector.RightHand),
         new LeafInvoke(() => lightSwitch.Set(switchTo > 0)),
         this.Node_Set(switchTo)
         );
 }
예제 #7
0
 public static Node DistractAndIncapacitate(
     SmartCharacter distractor, 
     SmartCharacter aggressor,
     SmartCharacter target)
 {
     return new Sequence(
         distractor.Node_GoToUpToRadius(Val.V(() => target.transform.position), 10f),
         new SequenceParallel(
             ReusableActions.Distract(distractor, target),
             new Sequence(
                 new LeafWait(17000),
                 aggressor.Node_GoTo(Val.V(() => target.WaypointBack.position)))),
         ReusableActions.IncapacitateFromBehind(aggressor, target));
 }
예제 #8
0
 protected Node ST_Take(SmartCharacter user, StateName holdingState, Node afterTake)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, StateName.IsStanding, ~StateName.HoldingBall, ~StateName.HoldingWallet, ~StateName.IsIncapacitated),
         this.Node_Require(StateName.RoleTable, holdingState),
         user.Node_GoTo(this.StandPoint.position),
         new SequenceParallel(
             user.Node_HeadLook(this.PropPickup.transform.position),
             user.Node_OrientTowards(this.PropPickup.transform.position)),
         new DecoratorCatch(
             () => { user.Character.StopInteraction(FullBodyBipedEffector.RightHand); user.Character.HeadLookStop(); },
             new Sequence(
                user.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.PropPickup),
                user.Node_WaitForTrigger(FullBodyBipedEffector.RightHand),
                new LeafInvoke(() => user.HoldPropRightHand.Attach(this.PropHolder.Release())),
                user.Node_HeadLookStop())),
         this.Node_Set(~holdingState),
         afterTake,
         user.Node_Set(holdingState),
         user.Node_StartInteraction(FullBodyBipedEffector.RightHand, user.InteractionHoldRight),
         user.Node_WaitForTrigger(FullBodyBipedEffector.RightHand),
         new LeafWait(300));
 }
예제 #9
0
 protected Node TellerPutHidden(SmartCharacter user)
 {
     return new Sequence(
         user.Node_GoTo(TellerStandPoint.position),
         user.Node_OrientTowards(CustomerStandPoint.position),
         user.ST_Pickup(HoldPropIntermediate, InteractionIntermediateTeller),
         new LeafInvoke(() => user.GetRightProp().FadeOut()),
         user.ST_Put(HoldPropStorage, InteractionStorage));
 }
예제 #10
0
 protected Node TellerPutMoney(SmartCharacter user)
 {
     return new Sequence(
         this.Node_Require(StateName.RoleTeller, StateName.HoldingWallet),
         user.Node_Require(StateName.RoleTeller, StateName.IsStanding, ~StateName.RightHandOccupied, ~StateName.IsIncapacitated),
         this.Node_Require(user.Id, RelationName.IsAdjacentTo),
         user.Node_GoTo(TellerStandPoint.position),
         user.Node_OrientTowards(CustomerStandPoint.position),
         user.ST_Pickup(HoldPropIntermediate, InteractionIntermediateTeller),
         user.ST_Put(HoldPropStorage, InteractionStorage),
         this.Node_Set(~StateName.HoldingWallet));
 }
예제 #11
0
 /// <summary>
 /// ABAS
 /// </summary>
 /// <param name="userA"></param>
 /// <param name="userB"></param>
 /// <param name="myAnims"></param>
 /// <param name="userAnims"></param>
 /// <returns></returns>
 public Node ST_DistractAndSteal(
     SmartCharacter userA,
     SmartCharacter userB) {
         Vector3 origPosition = userB.transform.position;
     return new Sequence(
         userA.Node_WaveTo(this),
         this.Node_OrientTowards(Val.V(() => userA.transform.position)),
         this.Node_GoToUpToRadius(Val.V(() => userA.transform.position), 1.2f),
         new SequenceParallel(
             userB.Node_HeadLook(Val.V(() => this.MarkerHead.position)),
         new SequenceParallel(
                 userA.ST_JustTalk(this),
                 new Sequence(
                     userB.Node_OrientTowards(Val.V(() => this.transform.position)),
                     new LeafWait(2000),
                     this.Steal(userB),
                     new LeafWait(1800),
                     userB.Node_GoTo(Val.V(() => origPosition)),
                     userB.Node_WaveTo(userA),
                     userA.Node_GoToUpToRadius(Val.V(() => userB.transform.position), 1.2f),
                     userB.ST_TalkHappily(userA))))
     
     );
 }
예제 #12
0
 protected Node Coerce(SmartCharacter user)
 {
     return new Sequence(
         // user.Node_Require(StateName.RoleActor, StateName.HoldingWeapon, StateName.IsStanding,
             // ~StateName.IsIncapacitated),
         // this.Node_Require(StateName.RoleActor, StateName.IsStanding, ~StateName.IsIncapacitated),
         new DecoratorForceStatus(
             RunStatus.Success,
             new Sequence(
                 new LeafAssert(() => WaypointFront == null),
                 this.ST_DoApproach(user, 1.0f))),
         new DecoratorForceStatus(
             RunStatus.Success,
             new Sequence(
                 new LeafAssert(() => WaypointFront != null),
                 user.Node_GoTo(Val.V(() => WaypointFront.position)),
                 user.Node_OrientTowards(this.transform.position),
                 this.Node_OrientTowards(Val.V(() => user.transform.position)))),
         //this.ST_DoApproach(user, 1.0f),
         user.Node_Icon("exclamation"),
         new LeafWait(2000),
         user.Node_Icon(null));
 }
예제 #13
0
 public Node TakeKeysFromBehind(SmartCharacter user)
 {
     return new Sequence(
         user.Node_GoTo(new Val<Vector3>(() => this.WaypointBack.transform.position)),
         user.Node_OrientTowards(Val.V(() => this.transform.position)),
         //this.Node_Icon("key"),
         user.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.InteractionStealWallet),
         // user.Node_WaitForTrigger(FullBodyBipedEffector.RightHand),
         user.Node_StopInteraction(FullBodyBipedEffector.RightHand),
         // this.Node_Icon(null),
         // user.Node_Icon("key"),
         new LeafWait(1000)//,
         // user.Node_Icon(null),
         // this.Node_Set(~StateName.HasKeys),
         // user.Node_Set(StateName.HasKeys));
     );    
 }
예제 #14
0
 protected Node IncapacitateFromBehind(SmartCharacter user)
 {
     return new Sequence(
         user.Node_GoTo(Val.V(() => this.WaypointBack.transform.position)),
         user.Node_Orient(Val.V(() => this.WaypointBack.transform.rotation)),
         user.behavior.ST_PlayHandGesture("bash", 1000),
         new LeafInvoke(() => this.CreateSlidebackTarget()),
         this.behavior.ST_PlayBodyGesture("dying", 2000),
         new LeafInvoke(() => this.DecorationStars.gameObject.SetActive(true)),
         this.Node_Set(StateName.IsIncapacitated));
 }
예제 #15
0
 public Node Approach(SmartCharacter user)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, StateName.IsStanding),
         user.Node_GoTo(target.position));
 }
예제 #16
0
 protected Node StandInFront(SmartCharacter user)
 {
     return new Sequence(
         user.Node_GoTo(CustomerStandPoint.position),
         user.Node_OrientTowards(TellerStandPoint.position),
         user.Node_NudgeTo(CustomerStandPoint.position));
 }
예제 #17
0
 protected Node GuardRear(SmartCharacter user)
 {
     return new Sequence(
         user.Node_GoTo(this.GuardWaypointRear.position),
         user.Node_Orient(this.GuardWaypointRear.rotation),
         user.Node_Set(StateName.IsGuarding, StateName.IsImmobile),
         user.Node_Set(this.Id, RelationName.IsGuarding),
         this.Node_Set(StateName.IsGuarded));
 }