public override IWorkshopTree Get(ActionSet actionSet, IWorkshopTree[] parameterValues) { DijkstraMultiSource algorithm = new DijkstraMultiSource( actionSet, actionSet.Translate.DeltinScript.SetupPathfinder(), (Element)actionSet.CurrentObject.GetVariable(), (Element)parameterValues[0], (Element)parameterValues[1] ); algorithm.Get(); 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])); DijkstraMultiSource algorithm = new DijkstraMultiSource( actionSet, actionSet.Translate.DeltinScript.SetupPathfinder(), (Element)actionSet.CurrentObject, (Element)parameterValues[0], (Element)destinationStore.GetVariable() ); algorithm.Get(); return(null); }
protected override MethodResult Get(PathfinderInfo info) { if (((VarRef)Parameters[1]).Var is PathMapVar == false) { throw SyntaxErrorException.InvalidVarRefType(((VarRef)Parameters[1]).Var.Name, VarType.PathMap, ParameterLocations[1]); } IndexedVar players = IndexedVar.AssignInternalVarExt(TranslateContext.VarCollection, Scope, "Players", TranslateContext.IsGlobal); TranslateContext.Actions.AddRange(players.SetVariable((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])); DijkstraMultiSource algorithm = new DijkstraMultiSource(TranslateContext, info, pathmap, players.GetVariable(), destination.GetVariable()); algorithm.Get(); return(new MethodResult(null, null)); }