Ejemplo n.º 1
0
        public override StateGraph CreateGraph()
        {
            StateGraph     stateGraph   = new StateGraph();
            LordToil_Sleep firstSource  = (LordToil_Sleep)(stateGraph.StartingToil = new LordToil_Sleep());
            LordToil       startingToil = stateGraph.AttachSubgraph(new LordJob_AssaultColony(faction).CreateGraph()).StartingToil;
            Transition     transition   = new Transition(firstSource, startingToil);

            transition.AddTrigger(new Trigger_PawnHarmed());
            transition.AddPreAction(new TransitionAction_Message("MessageSleepingPawnsWokenUp".Translate(faction.def.pawnsPlural).CapitalizeFirst(), MessageTypeDefOf.ThreatBig));
            transition.AddPostAction(new TransitionAction_WakeAll());
            stateGraph.AddTransition(transition);
            if (wakeUpIfColonistClose)
            {
                transition.AddTrigger(new Trigger_Custom((TriggerSignal x) => Find.TickManager.TicksGame % 30 == 0 && AnyColonistClose()));
            }
            return(stateGraph);
        }
Ejemplo n.º 2
0
        public override StateGraph CreateGraph()
        {
            StateGraph     stateGraph   = new StateGraph();
            LordToil_Sleep firstSource  = (LordToil_Sleep)(stateGraph.StartingToil = new LordToil_Sleep());
            LordToil       startingToil = stateGraph.AttachSubgraph(new LordJob_MechanoidsDefend(things, faction, defendRadius, defSpot, canAssaultColony, isMechCluster).CreateGraph()).StartingToil;
            Transition     transition   = new Transition(firstSource, startingToil);

            transition.AddTrigger(new Trigger_Custom((TriggerSignal signal) => signal.type == TriggerSignalType.DormancyWakeup));
            transition.AddTrigger(new Trigger_OnHumanlikeHarmAnyThing(things));
            transition.AddPreAction(new TransitionAction_Message("MessageSleepingPawnsWokenUp".Translate(faction.def.pawnsPlural).CapitalizeFirst(), MessageTypeDefOf.ThreatBig));
            transition.AddPostAction(new TransitionAction_WakeAll());
            transition.AddPostAction(new TransitionAction_Custom((Action) delegate
            {
                Find.SignalManager.SendSignal(new Signal("CompCanBeDormant.WakeUp", things.First().Named("SUBJECT"), Faction.OfMechanoids.Named("FACTION")));
                SoundDefOf.MechanoidsWakeUp.PlayOneShot(new TargetInfo(defSpot, base.Map));
            }));
            stateGraph.AddTransition(transition);
            return(stateGraph);
        }
        public override StateGraph CreateGraph()
        {
            StateGraph     stateGraph     = new StateGraph();
            LordToil_Sleep lordToil_Sleep = new LordToil_Sleep();

            stateGraph.StartingToil = lordToil_Sleep;
            LordToil   startingToil = stateGraph.AttachSubgraph(new LordJob_AssaultColony(this.faction, true, true, false, false, true).CreateGraph()).StartingToil;
            Transition transition   = new Transition(lordToil_Sleep, startingToil, false, true);

            transition.AddTrigger(new Trigger_PawnHarmed(1f, false, null));
            transition.AddPreAction(new TransitionAction_Message("MessageSleepingPawnsWokenUp".Translate(this.faction.def.pawnsPlural).CapitalizeFirst(), MessageTypeDefOf.ThreatBig, null, 1f));
            transition.AddPostAction(new TransitionAction_WakeAll());
            stateGraph.AddTransition(transition, false);
            if (this.wakeUpIfColonistClose)
            {
                transition.AddTrigger(new Trigger_Custom((TriggerSignal x) => Find.TickManager.TicksGame % 30 == 0 && this.AnyColonistClose()));
            }
            return(stateGraph);
        }
        public override StateGraph CreateGraph()
        {
            StateGraph     stateGraph   = new StateGraph();
            LordToil_Sleep firstSource  = (LordToil_Sleep)(stateGraph.StartingToil = new LordToil_Sleep());
            LordToil       startingToil = stateGraph.AttachSubgraph(new LordJob_AssaultColony(faction).CreateGraph()).StartingToil;
            Transition     transition   = new Transition(firstSource, startingToil);

            transition.AddTrigger(new Trigger_Custom((TriggerSignal signal) => signal.type == TriggerSignalType.DormancyWakeup));
            transition.AddPreAction(new TransitionAction_Message("MessageSleepingPawnsWokenUp".Translate(faction.def.pawnsPlural).CapitalizeFirst(), MessageTypeDefOf.ThreatBig));
            transition.AddPostAction(new TransitionAction_WakeAll());
            transition.AddPostAction(new TransitionAction_Custom((Action) delegate
            {
                Vector3 zero = Vector3.zero;
                for (int i = 0; i < lord.ownedPawns.Count; i++)
                {
                    zero += lord.ownedPawns[i].Position.ToVector3();
                }
                zero /= (float)lord.ownedPawns.Count;
                SoundDefOf.MechanoidsWakeUp.PlayOneShot(new TargetInfo(zero.ToIntVec3(), base.Map));
            }));
            stateGraph.AddTransition(transition);
            return(stateGraph);
        }