Example #1
0
    protected override void SetUpSchedules()
    {
        Task detectPlayer = new Task(new WaitTillPlayerCloseState(this, ref player));

        TimeTask moveToForest = new TimeTask(50f, new MoveState(this, MapLocations.MiddleOfHauntedForestMiddle));
        TimeTask moveToBridge = new TimeTask(50f, new MoveState(this, MapLocations.BridgeMiddle));
        TimeTask moveToLightHouse = new TimeTask(50f, new MoveState(this, MapLocations.LightHouseMiddle));
        TimeTask moveToReflectionTree = new TimeTask(50f, new MoveState(this, MapLocations.ReflectionTreeMiddle));
        TimeTask moveToCliff = new TimeTask(50f, new MoveState(this, MapLocations.TopOfFirstFloorStairsRightMiddle));
        TimeTask moveToWindmill = new TimeTask(50f, new MoveState(this, MapLocations.WindmillMiddle));

        runAway = new ScheduleLoop(this);
        runAway.Add (moveToForest);
        runAway.Add (detectPlayer);
        runAway.Add (moveToBridge);
        runAway.Add (detectPlayer);
        runAway.Add (moveToLightHouse);
        runAway.Add (detectPlayer);
        runAway.Add (moveToReflectionTree);

        runAway.Add (detectPlayer);
        runAway.Add (moveToCliff);
        runAway.Add (detectPlayer);
        runAway.Add (moveToWindmill);

        wanderAndPlayMusic = new ScheduleLoop(this);
        wanderAndPlayMusic.Add (moveToForest);
        wanderAndPlayMusic.Add (moveToBridge);
        wanderAndPlayMusic.Add (moveToLightHouse);
        wanderAndPlayMusic.Add (moveToReflectionTree);
        wanderAndPlayMusic.Add (moveToCliff);
        wanderAndPlayMusic.Add (moveToWindmill);

        SetupInstrumentSchedules ();
    }
Example #2
0
    protected override void SetUpSchedules()
    {
        ScheduleLoop newDefaultSched = new ScheduleLoop(this, Schedule.priorityEnum.Default);
        newDefaultSched.Add(new Task(new FishState(this)));
        this.AddSchedule(newDefaultSched);

        treasureHuntSched = new SeaCaptainTreasureHuntSchedule(this);

        talkToFortuneTellerFirstSched = new NPCConvoSchedule(this, NPCManager.instance.getNPC(StringsNPC.FortuneTellerMiddle), new MiddleSeaCaptainFortuneTellerFirstConvo(), Schedule.priorityEnum.Medium, true);
        talkToFortuneTellerSecondSched = new NPCConvoSchedule(this, NPCManager.instance.getNPC(StringsNPC.FortuneTellerMiddle), new MiddleSeaCaptainFortuneTellerSecondConvo(), Schedule.priorityEnum.Medium, true);
        TalktoCarpenterSon = new NPCConvoSchedule(this, NPCManager.instance.getNPC(StringsNPC.CarpenterSonMiddle), new MiddleSeaCaptainToCarpenterSon(), Schedule.priorityEnum.DoConvo, true);
        TalktoCarpenterSon.SetCanNotInteractWithPlayer();

        returnToDockSchedOne = new Schedule(this);
        returnToDockSchedOne.Add(new Task(new MoveThenMarkDoneState(this, startingPos)));

        returnToDockSchedTwo = new Schedule(this);
        returnToDockSchedTwo.Add(new Task(new MoveThenMarkDoneState(this, startingPos)));

        AfterTalkToCarpenterSon = new Schedule(this, Schedule.priorityEnum.High);
        Task FinishedTalking  = new TimeTask(0.05f, new IdleState(this));
        FinishedTalking.AddFlagToSet(FlagStrings.AfterConversationAboutBuildingShip);
        AfterTalkToCarpenterSon.Add (FinishedTalking);
    }
Example #3
0
    protected override void SetUpSchedules()
    {
        InitialSchedule = new ScheduleLoop(this, Schedule.priorityEnum.Medium);
        Task waitForPlayer = new Task(new WaitTillPlayerCloseState(this, ref player));
        InitialSchedule.Add(waitForPlayer);
        Task SayHi = new Task(new AbstractAnimationState(this, "Hi"), this, 0.1f, "Psst! Come over here!");
        InitialSchedule.Add(SayHi);
        InitialSchedule.Add(new Task(new WaitTillPlayerCloseState(this, ref player)));
        Task playWithSword = new Task(new AbstractAnimationState(this, "Play With Sword"));
        InitialSchedule.Add(playWithSword);

        AttemptToTellOnLighthouse = new NPCConvoSchedule(this, NPCManager.instance.getNPC(StringsNPC.FarmerFatherYoung),
            new LightHouseToFarmerFather(),Schedule.priorityEnum.DoConvo);
        AttemptToTellOnLighthouse.SetCanNotInteractWithPlayer();
        tellOnLighthouseConversationSchedule = new NPCConvoSchedule(this, NPCManager.instance.getNPC(StringsNPC.LighthouseGirlYoung),
            new YoungFarmerMotherToLighthouseGirlToldOn(),Schedule.priorityEnum.DoConvo);

        Task SetFlagToBeach = (new Task(new MoveThenDoState(this, this.gameObject.transform.position, new MarkTaskDone(this))));
        SetFlagToBeach.AddFlagToSet(FlagStrings.GoDownToBeach);

        TalkWithCastleman = new Schedule (this, Schedule.priorityEnum.DoNow);
        TalkWithCastleman.Add(new TimeTask(3000, new WaitTillPlayerCloseState(this, ref player)));
        Task setFlag = (new TimeTask(2f, new IdleState(this)));
        setFlag.AddFlagToSet(FlagStrings.StartTalkingToLighthouse);
        TalkWithCastleman.Add(setFlag);
        TalkWithCastleman.AddFlagGroup("TalkWithCastleman");

        GaveApple = new Schedule(this, Schedule.priorityEnum.High);
        GaveApple.Add(new TimeTask(10f, new AbstractAnimationState(this, "Play With Sword")));
        GaveApple.Add(SetFlagToBeach);
        //GaveApple.Add(new TimeTask(500f, new IdleState(this)));

        GaveNothingSchedule = new Schedule(this, Schedule.priorityEnum.High);
        GaveNothingSchedule.Add(new TimeTask(750f, new IdleState(this)));
        GaveNothingSchedule.Add(SetFlagToBeach);

        WalkToBeach = new Schedule(this, Schedule.priorityEnum.High);
        WalkToBeach.Add(new Task(new MoveThenMarkDoneState(this, MapLocations.MiddleOfBeachYoung)));
        Task setAtBeachFlag = new TimeTask(0f, new IdleState(this));
        setAtBeachFlag.AddFlagToSet(FlagStrings.LighthouseAtBeach);
        WalkToBeach.Add(setAtBeachFlag);

        LighthouseGoingToBeach = new NPCConvoSchedule(this, NPCManager.instance.getNPC(StringsNPC.FarmerMotherYoung),
            new LighthouseToFarmerMother(),Schedule.priorityEnum.DoConvo, true);
        LighthouseGoingToBeach.SetCanNotInteractWithPlayer();
    }
        private Schedule <GaussianDistribution> CreateMultipleTeamInnerPriorLoopSchedule()
        {
            int totalTeamDifferences = _TeamPerformancesToTeamPerformanceDifferencesLayer.LocalFactors.Count;

            var forwardScheduleList = new List <Schedule <GaussianDistribution> >();

            for (int i = 0; i < totalTeamDifferences - 1; i++)
            {
                Schedule <GaussianDistribution> currentForwardSchedulePiece =
                    ScheduleSequence(
                        new Schedule <GaussianDistribution>[]
                {
                    new ScheduleStep <GaussianDistribution>(
                        String.Format("team perf to perf diff {0}",
                                      i),
                        _TeamPerformancesToTeamPerformanceDifferencesLayer.LocalFactors[i], 0),
                    new ScheduleStep <GaussianDistribution>(
                        String.Format("greater than or within result factor {0}",
                                      i),
                        _TeamDifferencesComparisonLayer.LocalFactors[i],
                        0),
                    new ScheduleStep <GaussianDistribution>(
                        String.Format("team perf to perf diff factors [{0}], 2",
                                      i),
                        _TeamPerformancesToTeamPerformanceDifferencesLayer.LocalFactors[i], 2)
                }, "current forward schedule piece {0}", i);

                forwardScheduleList.Add(currentForwardSchedulePiece);
            }

            var forwardSchedule =
                new ScheduleSequence <GaussianDistribution>(
                    "forward schedule",
                    forwardScheduleList);

            var backwardScheduleList = new List <Schedule <GaussianDistribution> >();

            for (int i = 0; i < totalTeamDifferences - 1; i++)
            {
                var currentBackwardSchedulePiece = new ScheduleSequence <GaussianDistribution>(
                    "current backward schedule piece",
                    new Schedule <GaussianDistribution>[]
                {
                    new ScheduleStep <GaussianDistribution>(
                        String.Format("teamPerformanceToPerformanceDifferenceFactors[totalTeamDifferences - 1 - {0}] @ 0",
                                      i),
                        _TeamPerformancesToTeamPerformanceDifferencesLayer.LocalFactors[
                            totalTeamDifferences - 1 - i], 0),
                    new ScheduleStep <GaussianDistribution>(
                        String.Format("greaterThanOrWithinResultFactors[totalTeamDifferences - 1 - {0}] @ 0",
                                      i),
                        _TeamDifferencesComparisonLayer.LocalFactors[totalTeamDifferences - 1 - i], 0),
                    new ScheduleStep <GaussianDistribution>(
                        String.Format("teamPerformanceToPerformanceDifferenceFactors[totalTeamDifferences - 1 - {0}] @ 1",
                                      i),
                        _TeamPerformancesToTeamPerformanceDifferencesLayer.LocalFactors[
                            totalTeamDifferences - 1 - i], 1)
                }
                    );
                backwardScheduleList.Add(currentBackwardSchedulePiece);
            }

            var backwardSchedule =
                new ScheduleSequence <GaussianDistribution>(
                    "backward schedule",
                    backwardScheduleList);

            var forwardBackwardScheduleToLoop =
                new ScheduleSequence <GaussianDistribution>(
                    "forward Backward Schedule To Loop",
                    new Schedule <GaussianDistribution>[]
            {
                forwardSchedule, backwardSchedule
            });

            const double initialMaxDelta = 0.0001;

            var loop = new ScheduleLoop <GaussianDistribution>(
                String.Format("loop with max delta of {0}",
                              initialMaxDelta),
                forwardBackwardScheduleToLoop,
                initialMaxDelta);

            return(loop);
        }