public override void DoAction(Transition trans)
        {
            LordToil_Travel lordToil_Travel = (LordToil_Travel)trans.target;

            if (!lordToil_Travel.HasDestination())
            {
                Pawn pawn = lordToil_Travel.lord.ownedPawns.RandomElement();
                if (!CellFinder.TryFindRandomPawnExitCell(pawn, out var result))
                {
                    RCellFinder.TryFindRandomPawnEntryCell(out result, pawn.Map, 0f);
                }
                lordToil_Travel.SetDestination(result);
            }
        }
Exemplo n.º 2
0
        public override void DoAction(Transition trans)
        {
            LordToil_Travel lordToil_Travel = (LordToil_Travel)trans.target;

            if (!lordToil_Travel.HasDestination())
            {
                Pawn    pawn        = lordToil_Travel.lord.ownedPawns.RandomElement();
                IntVec3 destination = default(IntVec3);
                if (!CellFinder.TryFindRandomPawnExitCell(pawn, out destination))
                {
                    RCellFinder.TryFindRandomPawnEntryCell(out destination, pawn.Map, 0f, (Predicate <IntVec3>)null);
                }
                lordToil_Travel.SetDestination(destination);
            }
        }
        public override void DoAction(Transition trans)
        {
            LordToil_Travel lordToil_Travel = (LordToil_Travel)trans.target;

            if (lordToil_Travel.HasDestination())
            {
                return;
            }
            Pawn    pawn = lordToil_Travel.lord.ownedPawns.RandomElement <Pawn>();
            IntVec3 destination;

            if (!CellFinder.TryFindRandomPawnExitCell(pawn, out destination))
            {
                RCellFinder.TryFindRandomPawnEntryCell(out destination, pawn.Map, 0f, null);
            }
            lordToil_Travel.SetDestination(destination);
        }
Exemplo n.º 4
0
        public override StateGraph CreateGraph()
        {
            StateGraph      stateGraph      = new StateGraph();
            LordToil_Travel lordToil_Travel = new LordToil_Travel(this.travelDest);

            stateGraph.StartingToil = lordToil_Travel;
            LordToil_DefendPoint lordToil_DefendPoint = new LordToil_DefendPoint(false);

            stateGraph.AddToil(lordToil_DefendPoint);
            Transition transition = new Transition(lordToil_Travel, lordToil_DefendPoint, false, true);

            transition.AddTrigger(new Trigger_PawnHarmed(1f, false, null));
            transition.AddPreAction(new TransitionAction_SetDefendLocalGroup());
            transition.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition, false);
            Transition transition2 = new Transition(lordToil_DefendPoint, lordToil_Travel, false, true);

            transition2.AddTrigger(new Trigger_TicksPassedWithoutHarm(1200));
            transition2.AddPreAction(new TransitionAction_EnsureHaveExitDestination());
            stateGraph.AddTransition(transition2, false);
            return(stateGraph);
        }