public override IWorkshopTree Get(ActionSet actionSet, IWorkshopTree[] parameterValues) { Element position = (Element)parameterValues[0]; Element destination = (Element)parameterValues[1]; DijkstraNormal algorithm = new DijkstraNormal( actionSet, (Element)actionSet.CurrentObject.GetVariable(), position, destination ); algorithm.Get(); return(Element.Part <V_Append>(algorithm.finalPath.GetVariable(), destination)); }
public override IWorkshopTree Get(ActionSet actionSet, IWorkshopTree[] parameterValues) { DijkstraNormal algorithm = new DijkstraNormal( actionSet, (Element)actionSet.CurrentObject.GetVariable(), Element.Part <V_PositionOf>(parameterValues[0]), (Element)parameterValues[1] ); algorithm.Get(); DijkstraBase.Pathfind( actionSet, actionSet.Translate.DeltinScript.SetupPathfinder(), (Element)algorithm.finalPath.GetVariable(), (Element)parameterValues[0], (Element)parameterValues[1] ); return(null); }
public override IWorkshopTree Get(ActionSet actionSet, IWorkshopTree[] parameterValues) { IndexReference destinationStore = actionSet.VarCollection.Assign("_pathfindDestinationStore", actionSet.IsGlobal, true); actionSet.AddAction(destinationStore.SetVariable((Element)parameterValues[1])); DijkstraNormal algorithm = new DijkstraNormal( actionSet, (Element)actionSet.CurrentObject, (Element)parameterValues[0], (Element)destinationStore.GetVariable() ); algorithm.Get(); return(Element.Part <V_Append>(algorithm.finalPath.GetVariable(), destinationStore.GetVariable())); }
public override IWorkshopTree Get(ActionSet actionSet, IWorkshopTree[] parameterValues) { // Store the pathfind destination. IndexReference destinationStore = actionSet.VarCollection.Assign("_pathfindDestinationStore", actionSet.IsGlobal, true); actionSet.AddAction(destinationStore.SetVariable((Element)parameterValues[1])); DijkstraNormal algorithm = new DijkstraNormal( actionSet, (Element)actionSet.CurrentObject, Element.Part <V_PositionOf>(parameterValues[0]), (Element)destinationStore.GetVariable() ); algorithm.Get(); DijkstraBase.Pathfind( actionSet, actionSet.Translate.DeltinScript.SetupPathfinder(), (Element)algorithm.finalPath.GetVariable(), (Element)parameterValues[0], (Element)destinationStore.GetVariable() ); return(null); }
protected override MethodResult Get() { if (((VarRef)Parameters[0]).Var is PathMapVar == false) { throw SyntaxErrorException.InvalidVarRefType(((VarRef)Parameters[0]).Var.Name, VarType.PathMap, ParameterLocations[0]); } PathMapVar pathmap = (PathMapVar)((VarRef)Parameters[0]).Var; Element position = (Element)Parameters[1]; Element destination = (Element)Parameters[2]; DijkstraNormal algorithm = new DijkstraNormal(TranslateContext, pathmap, position, destination); algorithm.Get(); return(new MethodResult( null, Element.Part <V_Append>(algorithm.finalPath.GetVariable(), destination) )); }
override protected MethodResult Get(PathfinderInfo info) { if (((VarRef)Parameters[1]).Var is PathMapVar == false) { throw SyntaxErrorException.InvalidVarRefType(((VarRef)Parameters[1]).Var.Name, VarType.PathMap, ParameterLocations[1]); } Element player = (Element)Parameters[0]; PathMapVar pathmap = (PathMapVar)((VarRef)Parameters[1]).Var; IndexedVar destination = IndexedVar.AssignInternalVarExt(TranslateContext.VarCollection, Scope, "Destination", TranslateContext.IsGlobal); TranslateContext.Actions.AddRange(destination.SetVariable((Element)Parameters[2])); DijkstraNormal algorithm = new DijkstraNormal(TranslateContext, pathmap, Element.Part <V_PositionOf>(player), destination.GetVariable()); algorithm.Get(); DijkstraBase.Pathfind(TranslateContext, info, algorithm.finalPath.GetVariable(), player, destination.GetVariable()); return(new MethodResult(null, null)); }