Exemple #1
0
        public override StateGraph CreateGraph()
        {
            StateGraph stateGraph = new StateGraph();

            gatherAnimals = new LordToil_PrepareCaravan_GatherAnimals(meetingPoint);
            stateGraph.AddToil(gatherAnimals);
            gatherAnimals_pause = new LordToil_PrepareCaravan_Pause();
            stateGraph.AddToil(gatherAnimals_pause);
            gatherItems = new LordToil_PrepareCaravan_GatherItems(meetingPoint);
            stateGraph.AddToil(gatherItems);
            gatherItems_pause = new LordToil_PrepareCaravan_Pause();
            stateGraph.AddToil(gatherItems_pause);
            gatherSlaves = new LordToil_PrepareCaravan_GatherSlaves(meetingPoint);
            stateGraph.AddToil(gatherSlaves);
            gatherSlaves_pause = new LordToil_PrepareCaravan_Pause();
            stateGraph.AddToil(gatherSlaves_pause);
            gatherDownedPawns = new LordToil_PrepareCaravan_GatherDownedPawns(meetingPoint, exitSpot);
            stateGraph.AddToil(gatherDownedPawns);
            gatherDownedPawns_pause = new LordToil_PrepareCaravan_Pause();
            stateGraph.AddToil(gatherDownedPawns_pause);
            LordToil_PrepareCaravan_Wait lordToil_PrepareCaravan_Wait = new LordToil_PrepareCaravan_Wait(meetingPoint);

            stateGraph.AddToil(lordToil_PrepareCaravan_Wait);
            LordToil_PrepareCaravan_Pause lordToil_PrepareCaravan_Pause = new LordToil_PrepareCaravan_Pause();

            stateGraph.AddToil(lordToil_PrepareCaravan_Pause);
            leave = new LordToil_PrepareCaravan_Leave(exitSpot);
            stateGraph.AddToil(leave);
            leave_pause = new LordToil_PrepareCaravan_Pause();
            stateGraph.AddToil(leave_pause);
            LordToil_End lordToil_End = new LordToil_End();

            stateGraph.AddToil(lordToil_End);
            Transition transition = new Transition(gatherAnimals, gatherItems);

            transition.AddTrigger(new Trigger_Memo("AllAnimalsGathered"));
            stateGraph.AddTransition(transition);
            Transition transition2 = new Transition(gatherItems, gatherSlaves);

            transition2.AddTrigger(new Trigger_Memo("AllItemsGathered"));
            transition2.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition2);
            Transition transition3 = new Transition(gatherSlaves, gatherDownedPawns);

            transition3.AddTrigger(new Trigger_Memo("AllSlavesGathered"));
            transition3.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition3);
            Transition transition4 = new Transition(gatherDownedPawns, lordToil_PrepareCaravan_Wait);

            transition4.AddTrigger(new Trigger_Memo("AllDownedPawnsGathered"));
            transition4.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition4);
            Transition transition5 = new Transition(lordToil_PrepareCaravan_Wait, leave);

            transition5.AddTrigger(new Trigger_NoPawnsVeryTiredAndSleeping());
            transition5.AddPostAction(new TransitionAction_WakeAll());
            stateGraph.AddTransition(transition5);
            Transition transition6 = new Transition(leave, lordToil_End);

            transition6.AddTrigger(new Trigger_Memo("ReadyToExitMap"));
            transition6.AddPreAction(new TransitionAction_Custom(SendCaravan));
            stateGraph.AddTransition(transition6);
            Transition transition7 = PauseTransition(gatherAnimals, gatherAnimals_pause);

            stateGraph.AddTransition(transition7);
            Transition transition8 = UnpauseTransition(gatherAnimals_pause, gatherAnimals);

            stateGraph.AddTransition(transition8);
            Transition transition9 = PauseTransition(gatherItems, gatherItems_pause);

            stateGraph.AddTransition(transition9);
            Transition transition10 = UnpauseTransition(gatherItems_pause, gatherItems);

            stateGraph.AddTransition(transition10);
            Transition transition11 = PauseTransition(gatherSlaves, gatherSlaves_pause);

            stateGraph.AddTransition(transition11);
            Transition transition12 = UnpauseTransition(gatherSlaves_pause, gatherSlaves);

            stateGraph.AddTransition(transition12);
            Transition transition13 = PauseTransition(gatherDownedPawns, gatherDownedPawns_pause);

            stateGraph.AddTransition(transition13);
            Transition transition14 = UnpauseTransition(gatherDownedPawns_pause, gatherDownedPawns);

            stateGraph.AddTransition(transition14);
            Transition transition15 = PauseTransition(leave, leave_pause);

            stateGraph.AddTransition(transition15);
            Transition transition16 = UnpauseTransition(leave_pause, leave);

            stateGraph.AddTransition(transition16);
            Transition transition17 = PauseTransition(lordToil_PrepareCaravan_Wait, lordToil_PrepareCaravan_Pause);

            stateGraph.AddTransition(transition17);
            Transition transition18 = UnpauseTransition(lordToil_PrepareCaravan_Pause, lordToil_PrepareCaravan_Wait);

            stateGraph.AddTransition(transition18);
            return(stateGraph);
        }
        public override StateGraph CreateGraph()
        {
            StateGraph stateGraph = new StateGraph();

            this.gatherAnimals = new LordToil_PrepareCaravan_GatherAnimals(this.meetingPoint);
            stateGraph.AddToil(this.gatherAnimals);
            this.gatherAnimals_pause = new LordToil_PrepareCaravan_Pause();
            stateGraph.AddToil(this.gatherAnimals_pause);
            this.gatherItems = new LordToil_PrepareCaravan_GatherItems(this.meetingPoint);
            stateGraph.AddToil(this.gatherItems);
            this.gatherItems_pause = new LordToil_PrepareCaravan_Pause();
            stateGraph.AddToil(this.gatherItems_pause);
            this.gatherSlaves = new LordToil_PrepareCaravan_GatherSlaves(this.meetingPoint);
            stateGraph.AddToil(this.gatherSlaves);
            this.gatherSlaves_pause = new LordToil_PrepareCaravan_Pause();
            stateGraph.AddToil(this.gatherSlaves_pause);
            LordToil_PrepareCaravan_Wait lordToil_PrepareCaravan_Wait = new LordToil_PrepareCaravan_Wait(this.meetingPoint);

            stateGraph.AddToil(lordToil_PrepareCaravan_Wait);
            LordToil_PrepareCaravan_Pause lordToil_PrepareCaravan_Pause = new LordToil_PrepareCaravan_Pause();

            stateGraph.AddToil(lordToil_PrepareCaravan_Pause);
            this.leave = new LordToil_PrepareCaravan_Leave(this.exitSpot);
            stateGraph.AddToil(this.leave);
            this.leave_pause = new LordToil_PrepareCaravan_Pause();
            stateGraph.AddToil(this.leave_pause);
            LordToil_End lordToil_End = new LordToil_End();

            stateGraph.AddToil(lordToil_End);
            Transition transition = new Transition(this.gatherAnimals, this.gatherItems, false, true);

            transition.AddTrigger(new Trigger_Memo("AllAnimalsGathered"));
            stateGraph.AddTransition(transition);
            Transition transition2 = new Transition(this.gatherItems, this.gatherSlaves, false, true);

            transition2.AddTrigger(new Trigger_Memo("AllItemsGathered"));
            transition2.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition2);
            Transition transition3 = new Transition(this.gatherSlaves, lordToil_PrepareCaravan_Wait, false, true);

            transition3.AddTrigger(new Trigger_Memo("AllSlavesGathered"));
            transition3.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition3);
            Transition transition4 = new Transition(lordToil_PrepareCaravan_Wait, this.leave, false, true);

            transition4.AddTrigger(new Trigger_NoPawnsVeryTiredAndSleeping(0f));
            transition4.AddPostAction(new TransitionAction_WakeAll());
            stateGraph.AddTransition(transition4);
            Transition transition5 = new Transition(this.leave, lordToil_End, false, true);

            transition5.AddTrigger(new Trigger_Memo("ReadyToExitMap"));
            transition5.AddPreAction(new TransitionAction_Custom(new Action(this.SendCaravan)));
            stateGraph.AddTransition(transition5);
            Transition transition6 = this.PauseTransition(this.gatherAnimals, this.gatherAnimals_pause);

            stateGraph.AddTransition(transition6);
            Transition transition7 = this.UnpauseTransition(this.gatherAnimals_pause, this.gatherAnimals);

            stateGraph.AddTransition(transition7);
            Transition transition8 = this.PauseTransition(this.gatherItems, this.gatherItems_pause);

            stateGraph.AddTransition(transition8);
            Transition transition9 = this.UnpauseTransition(this.gatherItems_pause, this.gatherItems);

            stateGraph.AddTransition(transition9);
            Transition transition10 = this.PauseTransition(this.gatherSlaves, this.gatherSlaves_pause);

            stateGraph.AddTransition(transition10);
            Transition transition11 = this.UnpauseTransition(this.gatherSlaves_pause, this.gatherSlaves);

            stateGraph.AddTransition(transition11);
            Transition transition12 = this.PauseTransition(this.leave, this.leave_pause);

            stateGraph.AddTransition(transition12);
            Transition transition13 = this.UnpauseTransition(this.leave_pause, this.leave);

            stateGraph.AddTransition(transition13);
            Transition transition14 = this.PauseTransition(lordToil_PrepareCaravan_Wait, lordToil_PrepareCaravan_Pause);

            stateGraph.AddTransition(transition14);
            Transition transition15 = this.UnpauseTransition(lordToil_PrepareCaravan_Pause, lordToil_PrepareCaravan_Wait);

            stateGraph.AddTransition(transition15);
            return(stateGraph);
        }
        public override StateGraph CreateGraph()
        {
            StateGraph stateGraph = new StateGraph();
            LordToil_PrepareCaravan_GatherAnimals lordToil_PrepareCaravan_GatherAnimals = new LordToil_PrepareCaravan_GatherAnimals(this.meetingPoint);

            stateGraph.AddToil(lordToil_PrepareCaravan_GatherAnimals);
            LordToil_PrepareCaravan_Pause lordToil_PrepareCaravan_Pause = new LordToil_PrepareCaravan_Pause();

            stateGraph.AddToil(lordToil_PrepareCaravan_Pause);
            this.gatherItems = new LordToil_PrepareCaravan_GatherItems(this.meetingPoint);
            stateGraph.AddToil(this.gatherItems);
            LordToil_PrepareCaravan_Pause lordToil_PrepareCaravan_Pause2 = new LordToil_PrepareCaravan_Pause();

            stateGraph.AddToil(lordToil_PrepareCaravan_Pause2);
            LordToil_PrepareCaravan_GatherSlaves lordToil_PrepareCaravan_GatherSlaves = new LordToil_PrepareCaravan_GatherSlaves(this.meetingPoint);

            stateGraph.AddToil(lordToil_PrepareCaravan_GatherSlaves);
            LordToil_PrepareCaravan_Pause lordToil_PrepareCaravan_Pause3 = new LordToil_PrepareCaravan_Pause();

            stateGraph.AddToil(lordToil_PrepareCaravan_Pause3);
            LordToil_PrepareCaravan_Wait lordToil_PrepareCaravan_Wait = new LordToil_PrepareCaravan_Wait(this.meetingPoint);

            stateGraph.AddToil(lordToil_PrepareCaravan_Wait);
            LordToil_PrepareCaravan_Pause lordToil_PrepareCaravan_Pause4 = new LordToil_PrepareCaravan_Pause();

            stateGraph.AddToil(lordToil_PrepareCaravan_Pause4);
            LordToil_PrepareCaravan_Leave lordToil_PrepareCaravan_Leave = new LordToil_PrepareCaravan_Leave(this.exitSpot);

            stateGraph.AddToil(lordToil_PrepareCaravan_Leave);
            LordToil_PrepareCaravan_Pause lordToil_PrepareCaravan_Pause5 = new LordToil_PrepareCaravan_Pause();

            stateGraph.AddToil(lordToil_PrepareCaravan_Pause5);
            LordToil_End lordToil_End = new LordToil_End();

            stateGraph.AddToil(lordToil_End);
            Transition transition = new Transition(lordToil_PrepareCaravan_GatherAnimals, lordToil_End);

            transition.AddSource(this.gatherItems);
            transition.AddSource(lordToil_PrepareCaravan_GatherSlaves);
            transition.AddSource(lordToil_PrepareCaravan_Wait);
            transition.AddSource(lordToil_PrepareCaravan_Leave);
            transition.AddSource(lordToil_PrepareCaravan_Pause);
            transition.AddSource(lordToil_PrepareCaravan_Pause2);
            transition.AddSource(lordToil_PrepareCaravan_Pause3);
            transition.AddSource(lordToil_PrepareCaravan_Pause4);
            transition.AddSource(lordToil_PrepareCaravan_Pause5);
            transition.AddTrigger(new Trigger_Custom((TriggerSignal x) => x.type == TriggerSignalType.PawnLost && !this.caravanSent));
            transition.AddPreAction(new TransitionAction_Message("MessageFailedToSendCaravanBecausePawnLost".Translate(), MessageTypeDefOf.NegativeEvent));
            transition.AddPostAction(new TransitionAction_Custom(delegate
            {
                CaravanFormingUtility.Notify_FormAndSendCaravanLordFailed(this.lord);
            }));
            stateGraph.AddTransition(transition);
            Transition transition2 = new Transition(lordToil_PrepareCaravan_GatherAnimals, this.gatherItems);

            transition2.AddTrigger(new Trigger_Memo("AllAnimalsGathered"));
            stateGraph.AddTransition(transition2);
            Transition transition3 = new Transition(this.gatherItems, lordToil_PrepareCaravan_GatherSlaves);

            transition3.AddTrigger(new Trigger_Memo("AllItemsGathered"));
            stateGraph.AddTransition(transition3);
            Transition transition4 = new Transition(lordToil_PrepareCaravan_GatherSlaves, lordToil_PrepareCaravan_Wait);

            transition4.AddTrigger(new Trigger_Memo("AllSlavesGathered"));
            stateGraph.AddTransition(transition4);
            Transition transition5 = new Transition(lordToil_PrepareCaravan_Wait, lordToil_PrepareCaravan_Leave);

            transition5.AddTrigger(new Trigger_NoPawnsVeryTiredAndSleeping(0f));
            transition5.AddPostAction(new TransitionAction_WakeAll());
            stateGraph.AddTransition(transition5);
            Transition transition6 = new Transition(lordToil_PrepareCaravan_Leave, lordToil_End);

            transition6.AddTrigger(new Trigger_Memo("ReadyToExitMap"));
            transition6.AddPreAction(new TransitionAction_Custom(new Action(this.SendCaravan)));
            stateGraph.AddTransition(transition6);
            Transition transition7 = this.PauseTransition(lordToil_PrepareCaravan_GatherAnimals, lordToil_PrepareCaravan_Pause);

            stateGraph.AddTransition(transition7);
            Transition transition8 = this.UnpauseTransition(lordToil_PrepareCaravan_Pause, lordToil_PrepareCaravan_GatherAnimals);

            stateGraph.AddTransition(transition8);
            Transition transition9 = this.PauseTransition(this.gatherItems, lordToil_PrepareCaravan_Pause2);

            stateGraph.AddTransition(transition9);
            Transition transition10 = this.UnpauseTransition(lordToil_PrepareCaravan_Pause2, this.gatherItems);

            stateGraph.AddTransition(transition10);
            Transition transition11 = this.PauseTransition(lordToil_PrepareCaravan_GatherSlaves, lordToil_PrepareCaravan_Pause3);

            stateGraph.AddTransition(transition11);
            Transition transition12 = this.UnpauseTransition(lordToil_PrepareCaravan_Pause3, lordToil_PrepareCaravan_GatherSlaves);

            stateGraph.AddTransition(transition12);
            Transition transition13 = this.PauseTransition(lordToil_PrepareCaravan_Leave, lordToil_PrepareCaravan_Pause5);

            stateGraph.AddTransition(transition13);
            Transition transition14 = this.UnpauseTransition(lordToil_PrepareCaravan_Pause5, lordToil_PrepareCaravan_Leave);

            stateGraph.AddTransition(transition14);
            Transition transition15 = this.PauseTransition(lordToil_PrepareCaravan_Wait, lordToil_PrepareCaravan_Pause4);

            stateGraph.AddTransition(transition15);
            Transition transition16 = this.UnpauseTransition(lordToil_PrepareCaravan_Pause4, lordToil_PrepareCaravan_Wait);

            stateGraph.AddTransition(transition16);
            return(stateGraph);
        }