コード例 #1
0
        public Element Get(ResolveInfoComponent resolveInfo, ActionSet actionSet, Element target)
        {
            ActionSet       = actionSet;
            ResolveInfo     = resolveInfo;
            Target          = target;
            PathmapInstance = actionSet.Translate.DeltinScript.Types.GetInstance <PathmapClass>();

            // Lookahead status
            IndexReference result = actionSet.VarCollection.Assign("Lookahead: Result", actionSet.IsGlobal, true);

            actionSet.AddAction(result.SetVariable(new V_False()));

            // The lookhead controller
            Look = actionSet.VarCollection.Assign("Pathfind: Lookahead", actionSet.IsGlobal, true);
            actionSet.AddAction(Look.SetVariable(resolveInfo.Current.Get(target)));

            // The loop
            actionSet.AddAction(Element.Part <A_While>(Element.Part <V_And>(
                                                           !result.Get(),
                                                           LoopCondition()
                                                           )));

            // Set the result.
            actionSet.AddAction(result.SetVariable(SetResult()));

            // End
            actionSet.AddAction(Look.SetVariable(Next));
            actionSet.AddAction(new A_End());
            return(result.Get());
        }
コード例 #2
0
        public Element Get(ResolveInfoComponent resolveInfo, ActionSet actionSet, Element target)
        {
            ActionSet       = actionSet;
            ResolveInfo     = resolveInfo;
            Target          = target;
            PathmapInstance = actionSet.DeltinScript.GetComponent <PathfinderTypesComponent>().Pathmap;

            // Lookahead status
            IndexReference result = actionSet.VarCollection.Assign("Lookahead: Result", actionSet.IsGlobal, true);

            actionSet.AddAction(result.SetVariable(Element.False()));

            // The lookhead controller
            Look = actionSet.VarCollection.Assign("Pathfind: Lookahead", actionSet.IsGlobal, true);
            actionSet.AddAction(Look.SetVariable(resolveInfo.Current.Get(target)));

            // The loop
            actionSet.AddAction(Element.While(Element.And(
                                                  !result.Get(),
                                                  LoopCondition()
                                                  )));

            // Set the result.
            actionSet.AddAction(result.SetVariable(SetResult()));

            // End
            actionSet.AddAction(Look.SetVariable(Next));
            actionSet.AddAction(Element.End());
            return(result.Get());
        }
コード例 #3
0
        public PathfindAlgorithmBuilder(IPathfinderInfo pathfinderInfo)
        {
            Info        = pathfinderInfo;
            resolveInfo = actionSet.DeltinScript.GetComponent <ResolveInfoComponent>();

            Current     = actionSet.VarCollection.Assign("Dijkstra: Current", actionSet.IsGlobal, AssignExtended);
            Distances   = actionSet.VarCollection.Assign("Dijkstra: Distances", actionSet.IsGlobal, false);
            Unvisited   = actionSet.VarCollection.Assign("Dijkstra: Unvisited", actionSet.IsGlobal, false);
            ParentArray = actionSet.VarCollection.Assign("Dijkstra: Parent Array", actionSet.IsGlobal, false);
        }