コード例 #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
ファイル: Evt_GrabAndGive.cs プロジェクト: fgeraci/CS195-Core
 public Evt_GrabAndGive(SmartCharacter giver, SmartCharacter recipient, SmartTable table)
     : base(giver, recipient, table)
 {
     this.giver = giver;
     this.recipient = recipient;
     this.table = table;
 }
コード例 #3
0
ファイル: SmartTable.cs プロジェクト: fgeraci/CS195-Core
 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
ファイル: SmartDoor.cs プロジェクト: fgeraci/CS195-Core
 protected Node UnlockRear(SmartCharacter user)
 {
     return new Sequence(
         user.ST_StandAtWaypoint(this.UnlockWaypointRear),
         user.Node_Icon("key"),
         user.Node_PlayHandGesture("EnterCode", 3200),
         user.Node_Icon(null),
         this.Node_Icon(null),
         this.Node_Set(StateName.IsUnlocked));
 }
コード例 #6
0
ファイル: ReusableActions.cs プロジェクト: fgeraci/CS195-Core
 public static Node Distract(SmartCharacter distractor, SmartCharacter target)
 {
     return new Sequence
     (
         distractor.Node_Icon("speaking"),
         distractor.Behavior.ST_PlayHandGesture("callover", 3000),
         target.Node_GoToUpToRadius(Val.V(() => distractor.transform.position), 4.0f),
         new LeafAffordance("Talk", target, distractor),
         distractor.Node_Icon(null)
     );
 }
コード例 #7
0
ファイル: SmartContainer.cs プロジェクト: fgeraci/CS195-Core
 protected Node TeleportDropBackpack(SmartCharacter user)
 {
     return new Sequence(
         new LeafInvoke(() => this.transform.position = user.transform.position - 0.15f * user.transform.right
             + user.transform.forward),
         user.Behavior.Node_BodyAnimation("pickupleft", true),
         new LeafWait(500),
         new LeafInvoke(() => this.Holder.Attach(user.HoldPropLeftHand.Release())),
         new LeafWait(1500),
         this.Node_Set(StateName.HasBackpack, StateName.IsOccupied),
         user.Node_Set(~StateName.HasBackpack));
 }
コード例 #8
0
ファイル: SmartChair.cs プロジェクト: fgeraci/CS195-Core
 public Node Stand(SmartCharacter user)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, ~StateName.IsStanding, ~StateName.IsIncapacitated),
         user.Node_Require(this.Id, RelationName.IsSittingOn),
         this.Node_Require(StateName.RoleChair, StateName.IsOccupied),
         new LeafInvoke(() => user.Character.StandUp()),
         new LeafWait(1000),
         user.Node_Set(StateName.IsStanding),
         user.Node_Set(this.Id, ~RelationName.IsSittingOn),
         this.Node_Set(~StateName.IsOccupied));
 }
コード例 #9
0
ファイル: SmartTrashcan.cs プロジェクト: fgeraci/CS195-Core
    protected Node DropDrink(SmartCharacter user)
    {
        Prop toDestroy = null;

        return new Sequence(
            this.Node_Require(StateName.RoleTrashcan),
            user.Node_Require(StateName.RoleActor, StateName.IsStanding, StateName.HoldingDrink, StateName.RightHandOccupied),
            new LeafInvoke(() => toDestroy = user.HoldPropRightHand.CurrentProp),
            user.ST_StandAtWaypoint(this.StandPoint),
            user.ST_DropAndDestroy(DropTrash),
            user.Node_Set(~StateName.HoldingDrink, ~StateName.RightHandOccupied));            
    }
コード例 #10
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)));
 }
コード例 #11
0
ファイル: SmartTelevision.cs プロジェクト: fgeraci/CS195-Core
 /// <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)
         );
 }
コード例 #12
0
ファイル: SmartContainer.cs プロジェクト: fgeraci/CS195-Core
 protected Node PickupBackpack(SmartCharacter user)
 {
     return new Sequence(
         user.Node_GoToUpToRadius(Val.V(() =>
             this.ContainedProp.transform.position - 0.15f * user.transform.right), 1.0f),
         user.Behavior.Node_BodyAnimation("pickupleft", true),
         new LeafWait(500),
         new LeafInvoke(() => user.HoldPropLeftHand.Attach(this.Holder.Release())),
         new LeafWait(1000),
         this.Node_Set(~StateName.HasBackpack, ~StateName.IsOccupied),
         user.Node_Set(StateName.HasBackpack),
         new LeafWait(500));
 }
コード例 #13
0
ファイル: SmartLamp.cs プロジェクト: fgeraci/CS195-Core
 /// <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)
         );
 }
コード例 #14
0
ファイル: ReusableActions.cs プロジェクト: fgeraci/CS195-Core
 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));
 }
コード例 #15
0
ファイル: ReusableActions.cs プロジェクト: fgeraci/CS195-Core
    private static Node Coerce(
        SmartCharacter aggressor,
        SmartCharacter target,
        Val<float> distance)
    {
        return new Sequence(
            aggressor.Node_GoToUpToRadius(Val.V(() => target.transform.position), distance),
            aggressor.Node_OrientTowards(Val.V(() => target.transform.position)),
            aggressor.Node_Icon("stickup"),
            new SequenceParallel(
                aggressor.Behavior.ST_PlayHandGesture("pistolaim", 4000),
                new Sequence(
                    new LeafWait(2000),
                    target.Node_OrientTowards(Val.V(() => aggressor.transform.position)))));

    }
コード例 #16
0
ファイル: SmartVaultDoor.cs プロジェクト: fgeraci/CS195-Core
    protected Node Open(SmartCharacter user)
    {
        float elapsedTime = 0.0f;

        return new Sequence(
            this.UnlockFront(user),
            new LeafWait(1000),
            new LeafInvoke(() => updateLockBars = true),
            new LeafWait((long) lockBarOpenTime * 1000),
            new LeafInvoke(() => updateLockBars = false),
            new LeafInvoke(() => updateWheelRotation = true),
            new LeafWait(1500),
            new LeafInvoke(() => updateWheelRotation = false),
            new LeafInvoke(() => updateDoorRotation = true),
            new LeafWait((long) doorRotTime * 1000),
            new LeafInvoke(() => updateDoorRotation = false),
            this.Node_Set(StateName.IsOpen, StateName.IsUnlocked));
    }
コード例 #17
0
ファイル: SmartButton.cs プロジェクト: fgeraci/CS195-Core
 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());
 }
コード例 #18
0
ファイル: SmartChair.cs プロジェクト: fgeraci/CS195-Core
 public Node Sit(SmartCharacter user)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, StateName.IsStanding, ~StateName.IsIncapacitated),
         this.Node_Require(StateName.RoleChair, ~StateName.IsOccupied),
         this.Node_Set(StateName.IsOccupied),
         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),
         user.Node_Set(~StateName.IsStanding),
         user.Node_Set(this.Id, RelationName.IsSittingOn),
         new LeafInvoke(() => user.Character.SitDown()),
         new LeafWait(1000),
         new LeafInvoke(() => user.Character.NavOrientBehavior(OrientationBehavior.LookForward)));
 }
コード例 #19
0
ファイル: SmartContainer.cs プロジェクト: fgeraci/CS195-Core
 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));
 }
コード例 #20
0
ファイル: SmartCart.cs プロジェクト: fgeraci/CS195-Core
 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));
 }
コード例 #21
0
ファイル: SmartTable.cs プロジェクト: fgeraci/CS195-Core
 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));
 }
コード例 #22
0
ファイル: Evt_GetBall.cs プロジェクト: fgeraci/CS195-Core
 public Evt_GetBall(SmartCharacter grabber, SmartTable table)
     : base(grabber, table)
 {
     this.grabber = grabber;
     this.table = table;
 }
コード例 #23
0
 protected Node StandInFront(SmartCharacter user)
 {
     return new Sequence(
         user.Node_GoTo(CustomerStandPoint.position),
         user.Node_OrientTowards(TellerStandPoint.position),
         user.Node_NudgeTo(CustomerStandPoint.position));
 }
コード例 #24
0
 protected Node Leave(SmartCharacter user)
 {
     return new Sequence(
         user.Node_Set(~StateName.IsImmobile),
         this.Node_Set(~StateName.IsOccupied));
 }
コード例 #25
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));
 }
コード例 #26
0
 protected Node CustomerPutHidden(SmartCharacter user)
 {
     return new Sequence(
         new LeafInvoke(() => user.HoldPropRightHand.Attach(user.HoldPropHidden.Release())),
         new LeafInvoke(() => user.GetRightProp().FadeIn()),
         user.ST_Put(HoldPropIntermediate, InteractionIntermediateCustomer));
 }
コード例 #27
0
 protected Node CustomerPutMoney(SmartCharacter user)
 {
     return new Sequence(
         this.Node_Require(StateName.RoleTeller),
         user.Node_Require(StateName.RoleActor, StateName.IsStanding, ~StateName.RightHandOccupied, ~StateName.IsIncapacitated, StateName.HoldingWallet),
         user.ST_TakeWalletFromPocket(),
         user.ST_Put(HoldPropIntermediate, InteractionIntermediateCustomer),
         user.Node_Set(~StateName.HoldingWallet),
         this.Node_Set(StateName.HoldingWallet));
 }
コード例 #28
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));
 }
コード例 #29
0
 public TestSitEvent(SmartCharacter character, SmartChair chair)
     :base(character, chair)
 {
     this.character = character;
     this.chair = chair;
 }
コード例 #30
0
 public TestGoToEvent(SmartCharacter character, SmartWaypoint waypoint)
     :base(character, waypoint)
 {
     this.character = character;
     this.waypoint = waypoint;
 }