Ejemplo n.º 1
0
 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)
     );
 }
Ejemplo n.º 2
0
 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));
 }
Ejemplo n.º 3
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));
 }
Ejemplo n.º 4
0
    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)))));

    }
Ejemplo n.º 5
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));
 }
Ejemplo n.º 6
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)));
 }
Ejemplo n.º 7
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))))
     
     );
 }
Ejemplo n.º 8
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_ConverseThree(
     SmartCharacter userA,
     SmartCharacter userB) {
     return new Sequence(
         new SequenceParallel(
             Node_CallForAttention(userA),
             userA.Node_GoToUpToRadius(Val.V(() => this.transform.position), 1.2f),
             userB.Node_GoToUpToRadius(Val.V(() => this.transform.position), 1.2f)),
             userB.Node_HeadLook(Val.V(() => this.MarkerHead.position)),
             userB.Node_PlayHandGesture(Val<string>.V(() => "Dismiss"), Val<long>.V(() => 2000L)),
         new Sequence(
                 ST_TalkHappily(userA)),
                 new SequenceParallel(
                     userA.Node_OrientTowards(Val.V(() => userB.transform.position)),
                     userB.ST_TalkHappily(this),
                     ST_TalkHappily(userA))
     );
 }
Ejemplo n.º 9
0
    protected Node ST_Converse(
        SmartCharacter user, 
        AnimationDescription[] myAnims, 
        AnimationDescription[] userAnims)
    {
        return new Sequence(
			new SequenceParallel (
				Node_GoToUpToRadius(Val.V (() => user.transform.position), 1.3f),
				user.Node_GoToUpToRadius(Val.V (() => this.transform.position), 1.3f)),
                Node_HeadLook(Val.V(() => user.MarkerHead.position)),
                user.Node_HeadLook(Val.V(() => this.MarkerHead.position)),
            ST_PlayConversationAnims(user, myAnims, userAnims),
            Node_HeadLookStop(),
            user.Node_HeadLookStop()
        );
    }
Ejemplo n.º 10
0
 protected Node Incapacitate(SmartCharacter user)
 {
     return new Sequence(
         user.Node_Require(StateName.RoleActor, StateName.IsStanding, 
             ~StateName.HoldingBall, ~StateName.HoldingDrink, ~StateName.IsIncapacitated),
         this.Node_Require(StateName.RoleActor, StateName.IsStanding, ~StateName.IsDead),
         new LeafAssert(() => user != this), // Not reflexive
         user.Node_GoToUpToRadius(new Val<Vector3>(this.transform.position), 1.0f),
         new LeafInvoke(() => this.DecorationStars.gameObject.SetActive(true)),
         this.Node_Set(StateName.IsIncapacitated)
     );
 }
Ejemplo n.º 11
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));
 }
Ejemplo n.º 12
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)));
 }
Ejemplo n.º 13
0
 private static Node ApproachUpTo(SmartCharacter approacher, SmartCharacter target, float distance)
 {
     return new Sequence(
         approacher.Node_GoToUpToRadius(Val.V(() => target.transform.position), distance),
         approacher.Node_OrientTowards(Val.V(() => target.transform.position)));
 }
Ejemplo n.º 14
0
 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));
 }