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)); }
public Evt_GrabAndGive(SmartCharacter giver, SmartCharacter recipient, SmartTable table) : base(giver, recipient, table) { this.giver = giver; this.recipient = recipient; this.table = table; }
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))); }
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)); }
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)); }
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) ); }
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)); }
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)); }
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)); }
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))); }
/// <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) ); }
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)); }
/// <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) ); }
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)); }
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))))); }
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)); }
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()); }
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))); }
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)); }
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)); }
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)); }
public Evt_GetBall(SmartCharacter grabber, SmartTable table) : base(grabber, table) { this.grabber = grabber; this.table = table; }
protected Node StandInFront(SmartCharacter user) { return new Sequence( user.Node_GoTo(CustomerStandPoint.position), user.Node_OrientTowards(TellerStandPoint.position), user.Node_NudgeTo(CustomerStandPoint.position)); }
protected Node Leave(SmartCharacter user) { return new Sequence( user.Node_Set(~StateName.IsImmobile), this.Node_Set(~StateName.IsOccupied)); }
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)); }
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)); }
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)); }
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)); }
public TestSitEvent(SmartCharacter character, SmartChair chair) :base(character, chair) { this.character = character; this.chair = chair; }
public TestGoToEvent(SmartCharacter character, SmartWaypoint waypoint) :base(character, waypoint) { this.character = character; this.waypoint = waypoint; }