示例#1
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)));
 }
示例#2
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));

    }
示例#3
0
 protected Node PickupMoney(SmartCharacter user)
 {
     return new Sequence(
         user.ST_StandAtWaypoint(this.ApproachWaypoint),
         user.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.InteractionReachOut),
         user.Node_StartInteraction(FullBodyBipedEffector.LeftHand, this.InteractionReachOut),
         new LeafWait(800),
         user.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.InteractionReachIn),
         new LeafWait(300),
         new LeafInvoke(() => this.FadeOut()),
         new LeafInvoke(() => user.Backpack.FadeIn()),
         new LeafWait(500),
         new LeafInvoke(() => this.PlayParticles()),
         user.Node_StartInteraction(FullBodyBipedEffector.LeftHand, this.InteractionReachIn),
         new LeafWait(800),
         user.Node_StopInteraction(FullBodyBipedEffector.LeftHand),
         user.Node_StopInteraction(FullBodyBipedEffector.RightHand),
         this.Node_Set(~StateName.HasBackpack),
         user.Node_Set(StateName.HasBackpack),
         new LeafWait(500));
 }
示例#4
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)
         );
 }
示例#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.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)
         );
 }
示例#6
0
 protected Node Press(SmartCharacter user)
 {
     return new Sequence(
         user.ST_StandAtWaypoint(StandPoint),
         user.Node_StartInteraction(FullBodyBipedEffector.LeftHand, InteractionPress),
         user.Node_WaitForTrigger(FullBodyBipedEffector.LeftHand),
         new DecoratorLoop(
             10,
             new LeafInvoke(() => PhysicalPress.PhysicalButton.position 
                             += PhysicalPress.PressDirection.normalized * 0.003f)),
         new LeafInvoke(() => this.ButtonTransform.GetComponent<Renderer>().material.color = Color.green),
         new DecoratorLoop(
             10,
             new LeafInvoke(() => PhysicalPress.PhysicalButton.position 
                             -= PhysicalPress.PressDirection.normalized * 0.003f)),
         user.Node_StopInteraction(FullBodyBipedEffector.LeftHand),
         user.Node_HeadLookStop());
 }
示例#7
0
 protected Node PickupWeapon(SmartCharacter user)
 {
     return new Sequence(
         new Selector(
             new Sequence(
                 new LeafAssert(() => (user.transform.position - this.transform.position).magnitude < 1.0f),
                 new LeafInvoke(() => user.Character.NavStop())),
             user.Node_GoToUpToRadius(Val.V(() => this.transform.position), 1.0f)),
         user.Node_OrientTowards(Val.V(() =>this.transform.position)),
         user.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.InteractionTakeGun),
         new LeafWait(500),
         new LeafInvoke(() => this.Holder.CurrentProp.FadeOut()),
         new LeafWait(500),
         new LeafInvoke(() => user.HoldPropRightHand.Attach(this.Holder.Release())),
         new LeafInvoke(() => user.GetRightProp().FadeIn()),
         user.Node_StopInteraction(FullBodyBipedEffector.RightHand),
         new LeafWait(1000),
         this.Node_Set(~StateName.HoldingWeapon, ~StateName.IsOccupied),
         user.Node_Set(StateName.HoldingWeapon, StateName.RightHandOccupied));
 }
示例#8
0
 /// <summary>
 /// Subtree for Give. Here holdingState should be the StateName corresponding
 /// to the state for holding the object exchanged, e.g. HoldingWallet, HoldingBall.
 /// beforeGive and afterGive can be used to specify actions to be done both before the give starts
 /// (but after they have met and oriented towards each other) and to be done after the give ends.
 /// </summary>
 protected Node ST_Give(SmartCharacter user, StateName holdingState, Node beforeGive, Node afterGive)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, StateName.IsStanding, holdingState, ~StateName.IsIncapacitated),
         this.Node_Require(StateName.RoleActor, StateName.IsStanding, ~holdingState, ~StateName.IsIncapacitated),
         new SequenceParallel(
             user.Node_GoToUpToRadius(new Val<Vector3>(this.transform.position), 1.0f),
             this.Node_OrientTowards(new Val<Vector3>(user.transform.position)),
         user.Node_OrientTowards(new Val<Vector3>(this.transform.position))),
         beforeGive,
         new SequenceParallel(
             user.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.InteractionGive),
             new Sequence(
                 new LeafWait(1000),
                 this.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.InteractionTake)),
             user.Node_WaitForTrigger(FullBodyBipedEffector.RightHand),
             this.Node_WaitForTrigger(FullBodyBipedEffector.RightHand)),
         new LeafInvoke(() => this.HoldPropRightHand.Attach(user.HoldPropRightHand.Release())),
         user.Node_Set(~holdingState),
         afterGive,
         this.Node_Set(holdingState),
         new SequenceParallel(
             user.Node_StopInteraction(FullBodyBipedEffector.RightHand),
             this.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.InteractionHoldRight)));
 }
示例#9
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));
     );    
 }
示例#10
0
 protected Node TakeWeaponIncapacitated(SmartCharacter user)
 {
     return new Sequence(
         user.Node_GoToUpToRadius(Val.V(() => this.WaypointFront.position), 1.0f),
         user.Node_OrientTowards(Val.V(() => this.transform.position)),
         //TODO new interaction object to take the weapon?
         user.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.InteractionGive),
         user.Node_WaitForTrigger(FullBodyBipedEffector.RightHand),
         new LeafInvoke(() => user.HoldPropRightHand.Attach(this.HoldPropRightHand.Release())),
         this.Node_Set(~StateName.RightHandOccupied, ~StateName.HoldingWeapon),
         user.Node_Set(StateName.RightHandOccupied, StateName.HoldingWeapon),
         new LeafInvoke(() => Debug.Log("Here2")),
         user.Node_StopInteraction(FullBodyBipedEffector.RightHand));
 }
示例#11
0
 protected Node GiveBriefcase(SmartCharacter user)
 {
     return new Sequence(
         user.Node_GoToUpToRadius(Val.V(() => this.transform.position), 1.5f),
         new SequenceParallel(
             user.Node_OrientTowards(Val.V(() => this.transform.position)),
             this.Node_OrientTowards(Val.V(() => user.transform.position))),
         new SequenceParallel(
             user.Node_StartInteraction(FullBodyBipedEffector.LeftHand, this.InteractionGive),
             new Sequence(
                 new LeafWait(1000),
                 this.Node_StartInteraction(FullBodyBipedEffector.LeftHand, this.InteractionTake)),
             user.Node_WaitForTrigger(FullBodyBipedEffector.LeftHand),
             this.Node_WaitForTrigger(FullBodyBipedEffector.LeftHand)),
         new LeafInvoke(() => this.HoldPropLeftHand.Attach(user.HoldPropLeftHand.Release())),
         user.Node_Set(~StateName.HasBackpack),
         this.Node_Set(StateName.HasBackpack),
         new SequenceParallel(
             user.Node_StopInteraction(FullBodyBipedEffector.LeftHand),
             this.Node_StopInteraction(FullBodyBipedEffector.LeftHand)));
 }
示例#12
0
 protected Node GetGunIncapacitated(SmartCharacter user)
 {
     return new Sequence(
         user.ST_StandAtWaypoint(this.WaypointPickupGun),
         user.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.InteractionGetGunIncapacitated),
         new LeafWait(500),
         new LeafInvoke(() => this.GetRightProp().FadeOut()),
         new LeafWait(500),
         new LeafInvoke(() => user.HoldPropRightHand.Attach(this.HoldPropRightHand.Release())),
         new LeafInvoke(() => user.GetRightProp().FadeIn()),
         user.Node_StopInteraction(FullBodyBipedEffector.RightHand),
         this.Node_Set(~StateName.RightHandOccupied, ~StateName.HoldingWeapon),
         user.Node_Set(StateName.RightHandOccupied, StateName.HoldingWeapon),
         new LeafWait(1000));
 }
示例#13
0
 protected Node GetKeyIncapacitated(SmartCharacter user)
 {
     return new Sequence(
         user.ST_StandAtWaypoint(this.WaypointPickupKey),
         user.Node_StartInteraction(FullBodyBipedEffector.LeftHand, this.InteractionGetKeyIncapacitated),
         new LeafWait(1000),
         user.Node_Icon("key"),
         user.Node_StopInteraction(FullBodyBipedEffector.LeftHand),
         new LeafWait(1000),
         user.Node_Set(StateName.HasKeys),
         this.Node_Set(~StateName.HasKeys),
         user.Node_Icon(null));
 }
示例#14
0
 protected Node CoerceGiveKey(SmartCharacter user)
 {
     return new Sequence(
         //user.ST_StandAtWaypoint(this.WaypointFront),
         user.Node_Icon("key"),
         this.Node_StartInteraction(FullBodyBipedEffector.LeftHand, this.InteractionCoerceKeyTake),
         new LeafWait(1000),
         user.Node_StartInteraction(FullBodyBipedEffector.RightHand, this.InteractionCoerceKeyGive),
         new LeafWait(1000),
         user.Node_Icon(null),
         this.Node_Icon("key"),
         this.Node_StopInteraction(FullBodyBipedEffector.LeftHand),
         new LeafWait(300),
         user.Node_StopInteraction(FullBodyBipedEffector.RightHand),
         new LeafWait(700),
         this.Node_Icon(null));
 }
示例#15
0
 protected Node ST_Place(SmartCharacter user, StateName holdingState, Node beforePlace)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, StateName.IsStanding, holdingState, ~StateName.IsIncapacitated),
         this.Node_Require(StateName.RoleTable, ~StateName.HoldingBall, ~StateName.HoldingWallet, ~StateName.HoldingDrink),
         user.Node_GoTo(this.StandPoint.position),
         beforePlace,
         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(() => this.PropHolder.Attach(user.HoldPropRightHand.Release())),
                user.Node_HeadLookStop())),
         user.Node_Set(~holdingState),
         this.Node_Set(holdingState),
         user.Node_StopInteraction(FullBodyBipedEffector.RightHand),
         new LeafWait(1000));
 }
示例#16
0
 protected Node TeleportDropWeapon(SmartCharacter user)
 {
     return new Sequence(
         user.Node_StartInteraction(FullBodyBipedEffector.RightHand, user.InteractionDropGun),
         new LeafWait(500),
         new LeafInvoke(() => user.GetRightProp().FadeOut()),
         new LeafWait(500),
         new LeafInvoke(() => this.SetReceivePosition(user)),
         new LeafInvoke(() => this.Holder.Attach(user.HoldPropRightHand.Release())),
         new LeafInvoke(() => this.ContainedProp.FadeIn()),
         new LeafWait(500),
         user.Node_StopInteraction(FullBodyBipedEffector.RightHand),
         this.Node_Set(StateName.HoldingWeapon, StateName.IsOccupied),
         user.Node_Set(~StateName.HoldingWeapon, ~StateName.RightHandOccupied));
 }