protected Node BuildTreeRoot()
 {
     Val<float> pp = Val.V (() => police.transform.position.z);
     Func<bool> act = () => (police.transform.position.z > 10);
     Node roaming = new DecoratorLoop (
                     new Sequence(
                     this.ST_ApproachAndWait(this.wander1),
                     this.ST_ApproachAndWait(this.wander2),
                     this.ST_ApproachAndWait(this.wander3)));
     Node trigger = new DecoratorLoop (new LeafAssert (act));
     Node root = new DecoratorLoop (new DecoratorForceStatus (RunStatus.Success, new SequenceParallel(trigger, roaming)));
     return root;
 }
        //Run giving problem--think later
        protected Node BuildTreeRoot()
        {
            Func<bool> act = () => ( Math.Abs(this.Cop.transform.position.z - this.Thief.transform.position.z + this.Cop.transform.position.x - this.Thief.transform.position.x) > 5);
            Func<bool> near = () => (Math.Abs(this.Cop.transform.position.z - this.Thief.transform.position.z + this.Cop.transform.position.x - this.Thief.transform.position.x) > 5);
            Func<bool> goNearButton = () => (Math.Abs(this.shopKeeper.transform.position.x - this.sk_Wander3.position.x + this.shopKeeper.transform.position.z - this.sk_Wander3.position.z) < 6);
            //Func<bool> picked = () => (this.Thief.ch)
            Node Cop_Roaming = new Sequence(
                this.ST_ApproachAndWait(this.cop_Wander11, this.orientation, this.Cop)
                );
            Node Thief_Roaming = new Sequence(
                    this.ST_ApproachAndWait(this.stealSpot, this.sk_Wander3, this.Thief),
                    this.Thief.GetComponent<BehaviorMecanim>().Node_StartInteraction(FullBodyBipedEffector.LeftHand, this.ball));
            Node ShopKeeper_Roaming = new DecoratorLoop(
                new Sequence(
                    this.ST_ApproachAndWait(this.sk_Wander1, this.orientation, this.shopKeeper),
                    this.ST_ApproachAndWait(this.sk_Wander2, this.orientation, this.shopKeeper),
                    this.ST_ApproachAndWait(this.sk_Wander1, this.orientation, this.shopKeeper),
                    this.ST_ApproachAndWait(this.sk_Wander3, this.orientation, this.shopKeeper)
                //new LeafAssert(Thief_Status)
                ));

            Node escape = new Sequence(this.ST_ApproachAndWait(this.thief_Wander1, this.orientation, this.Thief),
                this.ST_ApproachAndWait(this.hide_Point, this.orientation, this.Thief)
                );
            Node trigger = new DecoratorLoop(new LeafAssert(act));
            Node thiefEscape = new DecoratorForceStatus(RunStatus.Success, new SequenceParallel(trigger, escape));
            Node buttonTrigger = new DecoratorLoop(new LeafAssert(goNearButton));
            Node Panic = new Sequence(
                   this.ST_ApproachAndWait(this.sk_Wander1, this.orientation, this.shopKeeper),
                   this.ST_ApproachAndWait(this.sk_Wander3, this.orientation, this.shopKeeper),
                   this.shopKeeper.GetComponent<BehaviorMecanim>().Node_StartInteraction(FullBodyBipedEffector.RightHand, this.button)
               );
            if (buttonTrigger.LastStatus == RunStatus.Success)
            {
                Panic = new Sequence(
                    this.ST_ApproachAndWait(this.sk_Wander3, this.orientation, this.shopKeeper),
                    this.shopKeeper.GetComponent<BehaviorMecanim>().Node_StartInteraction(FullBodyBipedEffector.RightHand, this.button)
                );
            }

            // Node RunTrigger = new DecoratorLoop(new LeafAssert(picked));

               /* Node trigger = new DecoratorLoop(new LeafAssert(act));
            Node thief = new DecoratorLoop(new DecoratorForceStatus(RunStatus.Success, new SequenceParallel(trigger, Thief_Roaming)));
            Node story = new SelectorParallel(ShopKeeper_Roaming, Thief_Roaming, Cop_Roaming);
            if (buttonTrigger.LastStatus == RunStatus.Success && trigger.LastStatus == RunStatus.Failure)
            {

            }*/
            Node Cop_shoot = new Sequence(this.ST_ApproachAndWait(this.cop_Wander11, this.Thief.transform, this.Cop),
                   this.Cop.GetComponent<BehaviorMecanim>().Node_HandAnimation("PISTOLAIM", true),
                   //new LeafWait(1000),
                   this.Cop.GetComponent<BehaviorMecanim>().Node_HandAnimation("PISTOLFIRE", true)
                   );
            Node Cop_talk = new Sequence(
                this.ST_ApproachAndWait(this.stealSpot, this.shopKeeper.transform, this.Cop),
                new SequenceShuffle(this.Cop.GetComponent<BehaviorMecanim>().ST_PlayHandGesture("SURPRISED", 500), new LeafWait(500),
                this.shopKeeper.GetComponent<BehaviorMecanim>().ST_PlayHandGesture("POINTING", 500), new LeafWait(500),
                this.Cop.GetComponent<BehaviorMecanim>().ST_PlayBodyGesture("ACKNOWLEDGE", 500), new LeafWait(500),
                this.shopKeeper.GetComponent<BehaviorMecanim>().ST_PlayFaceGesture("HEADNOD", 500), new LeafWait(500)),
                this.Cop.GetComponent<BehaviorMecanim>().ST_PlayBodyGesture("TALKING ON PHONE", 500), new LeafWait(1000)
                //this.ST_ApproachAndWait(this.cop_Wander1, this.Cop1.transform, this.Cop)
                );
            Node cop_trigger = new DecoratorLoop(new LeafAssert(near));
            Node copAction = new DecoratorForceStatus(RunStatus.Success, new SequenceParallel(cop_trigger, Cop_talk));
            Node Theif_Die = new Sequence(this.Thief.GetComponent<BehaviorMecanim>().Node_BodyAnimation("DIE",true));
            Node reset = new Sequence(this.Cop.GetComponent<BehaviorMecanim>().Node_HandAnimation("PISTOLFIRE", false),
                this.Cop.GetComponent<BehaviorMecanim>().Node_HandAnimation("PISTOLAIM", false));
            Node root = new Sequence(
            new SelectorParallel(Thief_Roaming, ShopKeeper_Roaming, Cop_Roaming),
            new SequenceParallel(
                new Sequence(new DecoratorForceStatus(RunStatus.Success, new SequenceParallel(Panic, thiefEscape)),
                    Cop_shoot,
                    Theif_Die,
                    new LeafWait(500),
                    reset),
                new Sequence(new DecoratorForceStatus(RunStatus.Success, new Sequence( copAction)))
                )
            );
            return root;
        }
        //Run giving problem--think later
        protected Node BuildTreeRoot()
        {
            Func<bool> act = () => (Math.Abs(this.Cop.transform.position.z - this.Thief.transform.position.z + this.Cop.transform.position.x - this.Thief.transform.position.x) > 5);
            Func<bool> near = () => (Math.Abs(this.Cop.transform.position.z - this.Thief.transform.position.z + this.Cop.transform.position.x - this.Thief.transform.position.x) < 5);
            Func<bool> goNearButton = () => (Math.Abs(this.shopKeeper.transform.position.x - this.sk_Wander3.position.x + this.shopKeeper.transform.position.z - this.sk_Wander3.position.z) < 6);

            Node Thief_Roaming = new Sequence(
                    //this.ST_ApproachAndWait(this.thief_Wander1, this.orientation, this.Thief),
                    //this.ST_ApproachAndWait(this.thief_Wander2, this.orientation, this.Thief),
                    //this.ST_ApproachAndWait(this.thief_Wander1, this.orientation, this.Thief),
                    //this.ST_ApproachAndWait(this.thief_Wander3, this.orientation, this.Thief),
                    this.ST_ApproachAndWait(this.stealSpot, this.sk_Wander3, this.Thief),
                    this.Thief.GetComponent<BehaviorMecanim>().Node_StartInteraction(FullBodyBipedEffector.LeftHand, this.ball));

            Func<bool> Thief_Status = () => (!Thief_Roaming.IsRunning);
            Node ShopKeeper_Roaming = new DecoratorLoop(
                new Sequence(
                    this.ST_ApproachAndWait(this.sk_Wander1, this.orientation, this.shopKeeper),
                    this.ST_ApproachAndWait(this.sk_Wander2, this.orientation, this.shopKeeper),
                    this.ST_ApproachAndWait(this.sk_Wander1, this.orientation, this.shopKeeper),
                    this.ST_ApproachAndWait(this.sk_Wander3, this.orientation, this.shopKeeper)
                    //new LeafAssert(Thief_Status)
                ));

            Node escape = new Sequence(this.ST_ApproachAndWait(this.thief_Wander1, this.orientation, this.Thief),
                this.ST_ApproachAndWait(this.hide_Point, this.orientation, this.Thief)
                );
            Node trigger = new DecoratorLoop(new LeafAssert(act));
            Node thiefEscape = new DecoratorForceStatus(RunStatus.Success, new SequenceParallel(trigger, escape));
            Node buttonTrigger = new DecoratorLoop(new LeafAssert(goNearButton));
            Node Panic = new Sequence(
                   this.ST_ApproachAndWait(this.sk_Wander1, this.orientation, this.shopKeeper),
                   this.ST_ApproachAndWait(this.sk_Wander3, this.orientation, this.shopKeeper),
                   this.shopKeeper.GetComponent<BehaviorMecanim>().Node_StartInteraction(FullBodyBipedEffector.RightHand, this.button)
               );
            if (buttonTrigger.LastStatus == RunStatus.Success)
            {
                print("Here");
                Panic = new Sequence(
                    this.ST_ApproachAndWait(this.sk_Wander3, this.orientation, this.shopKeeper),
                    this.shopKeeper.GetComponent<BehaviorMecanim>().Node_StartInteraction(FullBodyBipedEffector.RightHand, this.button)
                );
            }

            Node Cop_shoot = new Sequence(this.ST_ApproachAndWait(this.cop_Wander11, this.orientation, this.Cop),
                   this.Cop.GetComponent<BehaviorMecanim>().Node_HandAnimation("PISTOLAIM", true),
                   new LeafWait(1000),
                   this.Cop.GetComponent<BehaviorMecanim>().Node_HandAnimation("PISTOLFIRE", true)
                   );

            Node Cop_talk = new Sequence(
                this.ST_ApproachAndWait(this.stealSpot, this.orientation, this.Cop),
                new DecoratorLoop(4,
                new SequenceShuffle(this.Cop.GetComponent<BehaviorMecanim>().ST_PlayHandGesture("SURPRISED", 500), new LeafWait(500),
                this.shopKeeper.GetComponent<BehaviorMecanim>().ST_PlayHandGesture("POINTING", 500), new LeafWait(500),
                this.Cop.GetComponent<BehaviorMecanim>().ST_PlayBodyGesture("ACKNOWLEDGE", 500), new LeafWait(500),
                this.shopKeeper.GetComponent<BehaviorMecanim>().ST_PlayFaceGesture("HEADNOD", 500), new LeafWait(500))
                ),
                this.Cop.GetComponent<BehaviorMecanim>().ST_PlayBodyGesture("TALKING ON PHONE", 500), new LeafWait(1000)
                );
            Node copEscape = new DecoratorForceStatus(RunStatus.Success, new SequenceParallel(trigger, Cop_talk));
            Func<bool> abc = () => (2 > 1);
            Node shoot_trigger = new DecoratorLoop(new LeafAssert(near));
            Node temp = new DecoratorLoop(new LeafAssert(abc));
            //Node Cop_action = new SelectorParallel( new SequenceParallel(shoot_trigger, Cop_shoot), new SequenceParallel(trigger, Cop_talk));
            //new DecoratorForceStatus(RunStatus.Success, new Sequence(shoot_trigger, Cop_shoot)),
            //new DecoratorForceStatus(RunStatus.Success, new Sequence(trigger, Cop_talk))

            Node root = new Sequence(
            new SelectorParallel(Thief_Roaming, ShopKeeper_Roaming),
            new SequenceParallel(Panic, copEscape)

            );
            return root;
        }
    protected Node BuildTreeRoot()
    {
        DecoratorLoop applaud =
            new DecoratorLoop(
                AudienceApplaud());

        return new SequenceParallel (
            new SequenceParallel (
                new Sequence (Prefight (participant1), ApproachFight (participant1)),
                new Sequence (Prefight (participant2), ApproachFight (participant2)),
                new Sequence (Prefight (participant3), ApproachFight (participant3))
            ),
            applaud
        );
    }
    protected Node BuildTreeRoot()
    {
        DecoratorLoop applaud =
            new DecoratorLoop(
                AudienceApplaud());

        SequenceParallel start = new SequenceParallel(
            ST_ApproachAndWait(participant1, wander1.transform.position, 1000),
            ST_ApproachAndWait(participant2, wander1.transform.position, 1000));

        return new SequenceParallel (
            new SequenceParallel (
                new Sequence (Prefight (participant1), ApproachFight (participant1)),
                new Sequence (Prefight (participant2), ApproachFight (participant2)),
                new Sequence (Prefight (participant3), ApproachFight (participant3))
            ),
            new DecoratorLoop (applaud)
        );
    }