コード例 #1
0
        public override StateGraph CreateGraph()
        {
            StateGraph        graph            = base.CreateGraph();
            List <Transition> leaveTransitions = graph.transitions.FindAll(x => x.target.GetType() == typeof(LordToil_ExitMapAndEscortCarriers));

            for (int i = 0; i < leaveTransitions.Count; i++)
            {
                LordToil_LeaveInShip lordToil = new LordToil_LeaveInShip();
                leaveTransitions[i].target = lordToil;

                graph.AddToil(lordToil);
                Transition transition = new Transition(leaveTransitions[i].target, new LordToil_ExitMapAndEscortCarriers());
                transition.AddTrigger(new Trigger_Custom((TriggerSignal x) => this.ships.All(z => z.Destroyed) || !this.ships.Any(y => y.Map == this.Map && y.Spawned)));
                graph.transitions.Add(transition);
            }

            return(graph);
        }
コード例 #2
0
        public override StateGraph CreateGraph()
        {
            StateGraph        graph            = base.CreateGraph();
            List <Transition> leaveTransitions = graph.transitions.FindAll(x => x.target.GetType() == typeof(LordToil_ExitMapAndEscortCarriers));

            for (int i = 0; i < leaveTransitions.Count; i++)
            {
                LordToil_LeaveInShip lordToil = new LordToil_LeaveInShip();
                leaveTransitions[i].target = lordToil;

                graph.AddToil(lordToil);
                Transition transition = new Transition(leaveTransitions[i].target, new LordToil_ExitMapAndEscortCarriers());
                transition.AddTrigger(new Trigger_Custom((TriggerSignal x) => !this.ships.Any(y => y.Map == this.Map)));
                graph.transitions.Add(transition);
            }
            Transition            stealTransitions = graph.transitions.FirstOrDefault(x => x.target.GetType() == typeof(LordToil_StealCover));
            LordToil_StealForShip stealToil        = new LordToil_StealForShip();

            graph.AddToil(stealToil);
            stealTransitions.target = stealToil;

            return(graph);
        }