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)); }
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 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 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 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)); }
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 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)); }
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 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)); }
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)); }
protected Node PickupWallet(SmartCharacter user) { return new Sequence( ST_PickupRightHand(user, StateName.HoldingWallet), user.ST_PutWalletInPocket(), user.Node_Set(~StateName.RightHandOccupied)); }
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)); }
protected Node StopGuarding(SmartCharacter user) { return new Sequence( user.Node_Set(~StateName.IsGuarding, ~StateName.IsImmobile), user.Node_Set(this.Id, ~RelationName.IsGuarding), this.Node_Set(~StateName.IsGuarded)); }
protected Node ST_Drop(SmartCharacter user, StateName holdingState, PropHolder holder) { return new Sequence( user.Node_Require(StateName.RoleActor, holdingState, StateName.IsStanding), this.Node_Require(StateName.RoleContainer, ~StateName.IsOccupied), new LeafInvoke(() => this.Holder.Attach(holder.Release())), this.Node_Set(holdingState, StateName.IsOccupied), user.Node_Set(~holdingState)); }
protected Node GiveKey(SmartCharacter user) { return new Sequence( user.Node_Require(StateName.RoleActor, StateName.HasKeys, StateName.IsStanding, ~StateName.IsIncapacitated), this.Node_Require(StateName.RoleActor, ~StateName.HasKeys, StateName.IsStanding, ~StateName.IsIncapacitated), user.Node_Icon("key"), new LeafWait(2000), user.Node_Icon(null), this.Node_Icon("key"), new LeafWait(2000), this.Node_Icon(null), user.Node_Set(~StateName.HasKeys), this.Node_Set(StateName.HasKeys)); }
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))); }
protected Node ST_PickupLeftHand(SmartCharacter user, StateName holdingState) { return new Sequence( user.Node_Require(StateName.RoleActor, ~StateName.LeftHandOccupied, StateName.IsStanding), this.Node_Require(StateName.RoleContainer, holdingState, StateName.IsOccupied), user.Node_GoToUpToRadius(Val.V(() => this.ContainedProp.transform.position + 0.15f * user.transform.right), 0.1f), user.Behavior.Node_BodyAnimation("pickupleft", true), new LeafWait(500), new LeafInvoke(() => user.HoldPropLeftHand.Attach(this.Holder.Release())), this.Node_Set(~holdingState, ~StateName.IsOccupied), user.Node_Set(holdingState, StateName.LeftHandOccupied), new LeafWait(500)); }
protected Node ST_DropRightHand(SmartCharacter user, StateName holdingState) { return new Sequence( user.Node_Require(StateName.RoleActor, StateName.RightHandOccupied, holdingState, StateName.IsStanding), this.Node_Require(StateName.RoleContainer, ~StateName.IsOccupied), new LeafInvoke(() => this.transform.position = user.transform.position), new LeafInvoke(() => this.Holder.Attach(user.HoldPropRightHand.Release())), this.Node_Set(holdingState, StateName.IsOccupied), user.Node_Set(~holdingState, ~StateName.RightHandOccupied)); }
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)); }
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)); }
/// <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))); }
public static Node CoerceIntoGivingKey( SmartCharacter coercer, SmartCharacter target) { return new Sequence( ApproachUpTo(coercer, target, 2.0f), BeginCoerce(coercer, target), new LeafAffordance("CoerceGiveKey", target, coercer), EndCoerce(coercer), target.Node_Set(~StateName.HasKeys), coercer.Node_Set(StateName.HasKeys)); }
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)); }
public static Node BreakAlliance(SmartCharacter char1, SmartCharacter char2) { return new Sequence( char1.Node_Set(char2.Id, ~RelationName.IsAlliedWith), char2.Node_Set(char1.Id, ~RelationName.IsAlliedWith)); }
protected Node Leave(SmartCharacter user) { return new Sequence( user.Node_Set(~StateName.IsImmobile), this.Node_Set(~StateName.IsOccupied)); }
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)); }