Ejemplo n.º 1
0
    protected Node BuildTreeRoot()
    {
        //Func<bool> act = () => (zombies[8].transform.position.z > -25);
        //Node trigger = new DecoratorLoop(new LeafAssert(act));
        ForEach<GameObject> crowdFlee = new ForEach<GameObject>((crowdmem) =>
        {
            return new Sequence(

                this.ST_ApproachAndWaitCrowd(crowdmem, locations[16]));

        }, crowd);

        ForEach<GameObject> zombieAttack = new ForEach<GameObject>((zombie) =>
        {
            return new DecoratorLoop(
             new SequenceShuffle(
                this.ST_ApproachAndWaitZombie(zombie, locations[0]),
                this.ST_ApproachAndWaitZombie(zombie, locations[1]),
                this.ST_ApproachAndWaitZombie(zombie, locations[2]),
                this.ST_ApproachAndWaitZombie(zombie, locations[3]),
                this.ST_ApproachAndWaitZombie(zombie, locations[4]),
                this.ST_ApproachAndWaitZombie(zombie, locations[5]),
                this.ST_ApproachAndWaitZombie(zombie, locations[6]),
                this.ST_ApproachAndWaitZombie(zombie, locations[7]),
                this.ST_ApproachAndWaitZombie(zombie, locations[8]),
                this.ST_ApproachAndWaitZombie(zombie, locations[9]),
                this.ST_ApproachAndWaitZombie(zombie, locations[10]),
                this.ST_ApproachAndWaitZombie(zombie, locations[11])

                ));

        }, zombies);

            Sequence beginStory = new Sequence(

            this.ST_ApproachAndOrient(locations[0], numberOfParticipants[0].gameObject.transform, locations[1], numberOfParticipants[1].gameObject.transform),
            this.SetCamera(1),
            this.ST_ShakeHands(obj[0], eff[0], eff[0]),
            //this.ST_ShakeHands(numberOfParticipants[0].GetComponent<InteractionObject>(), eff[0], eff[0]),
            new SequenceParallel(
                new DecoratorLoop(5,
                this.Converse()),
                new Sequence(
                    this.Quote("Hey man, good to see you."),
                    new LeafWait(2000),
                    this.Quote("Isn't this a great party!"),
                    new LeafWait(2000),
                    this.Quote("Yeah, but lets see if we can kick it up a notch."),
                    new LeafWait(3000),
                    this.Quote("What do you mean?"),
                    new LeafWait(2000),
                    this.Quote("You heard the rumor about the abandoned shack over there right?"),
                    new LeafWait(3000),
                    this.Quote("No, tell me."),
                    new LeafWait(2000),
                    this.Quote("They say the owner was a deranged serial killer who would take his victims to that shack and do horrible things!"),
                    new LeafWait(4000),
                    this.Quote("When he was done he would store their bodies in that barn."),
                    new LeafWait(3000),
                    this.Quote("What that is crazy. I do not beleive it."),
                    new LeafWait(3000),
                    this.Quote("Well then I dare you go check out the barn."),
                    new LeafWait(3000),
                    this.Quote("All right let's do this!"),
                    new LeafWait(2000),
                    new LeafInvoke(() => {
                        numberOfParticipants[2].SetActive(false);
                    }, () => { })

        )));

        Sequence middleStory = new Sequence(
            this.SetCamera(2),
            this.ST_ApproachAndOrient(locations[2], numberOfParticipants[0].gameObject.transform, locations[3], numberOfParticipants[1].gameObject.transform),
            this.SetCamera(3),
             new SequenceParallel(
                new DecoratorLoop(2,
                this.Converse()),
                new Sequence(
                    this.Quote("Here it is."),
                    new LeafWait(2000),
                    this.Quote("Just open the door and see what is inside."),
                    new LeafWait(2000),
                    this.Quote("All right, but I am telling you it is nothing."),
                    new LeafWait(2000),
                     new LeafInvoke(() =>
                     {
                         numberOfParticipants[2].SetActive(false);
                     }, () => { })

                )),
             this.ST_PushButton(eff[0], obj[1], locations[4], 0),
                new Sequence(
                    this.Quote("What is that?"),
                    new LeafWait(2000),
                    this.Quote("Oh no ZOMBIES!!!!!!"),
                    new LeafWait(2000),
                    this.Quote("Let's get out of here!"),
                    new LeafWait(2000),
                     new LeafInvoke(() =>
                     {
                         numberOfParticipants[2].SetActive(false);
                     }, () => { })

                 ));

        SequenceParallel endStory = new SequenceParallel(

               zombieAttack,

               this.ST_ApproachAndWait(numberOfParticipants[0], locations[15]),
               this.ST_ApproachAndWait(numberOfParticipants[1], locations[15]),
               new Sequence(
                    this.Quote("Everybody RUN!!!"),
                    new LeafWait(2000),
                    this.Quote("AHHHHH!!!"),
                    new LeafWait(2000),
                    this.Quote("AGGGHHHHYYY!!!!!"),
                    new LeafWait(2000),
                     new LeafInvoke(() =>
                     {
                         numberOfParticipants[2].SetActive(false);
                         partyBool.mainEvent = true;
                         //Debug.Log("Setting part bool");
                     }, () => { }),
                     new SequenceParallel(
                        this.SetCamera(4),
                        crowdFlee
                     )
                )
               );

        return new Sequence(  beginStory, middleStory,
            endStory

            );
    }
    //TODO Rewrite with ForEach
    protected Node ST_DanceParty()
    {
        SequenceParallel danceSeq = new SequenceParallel(
            new DecoratorLoop(this.DanceByMusicID (danceParticipant)),
            new DecoratorLoop(this.DanceByMusicID (danceParticipant2)),
            new DecoratorLoop(this.DanceByMusicID (danceParticipant3)),
            new LeafTrace ("Hey")
        );

        return danceSeq;
    }
    protected Node ST_story_two_arc()
    {
        print(" here is story two process");
        Node walkToMeetingPoint = new SequenceParallel(
            ST_ApproachAndWait(Daniel,Box1pickup),
            ST_ApproachAndWait(Richard,Box5pickup));
        /*ST_ApproachAndWait(Tom,     box1_transform)*/
        print ("After walking");
        if (walkToMeetingPoint.LastStatus == RunStatus.Success)
            behavior_tree.meet_one_point = true; //flag set.
        //Node chat = new ForEach<GameObject>((GameObject participant) => ST_Chat(participant), new [] {Daniel, Richard, Tom});

        return new Sequence (walkToMeetingPoint);// chat);
    }
    protected Node ST_story_one_arc()
    {
        print(" here is story one process");
        Node walkToMeetingPoint = new SequenceParallel(
            ST_ApproachAndWait(Daniel,  meetingPointDaniel),
            ST_ApproachAndWait(Richard, meetingPointRichard),
            ST_ApproachAndWait(Tom,     meetingPointTom));
        print("After walking");
        if (walkToMeetingPoint.LastStatus == RunStatus.Running)
            behavior_tree.meet_one_point = true; //flag set.
        //Node chat = new ForEach<GameObject>((GameObject participant) => ST_Chat(participant), new [] {Daniel, Richard, Tom});

        return new Sequence (walkToMeetingPoint);// chat);
    }
    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)
        );
    }