protected override void Context() { _globalPKAnalysisPresenter = A.Fake <IGlobalPKAnalysisPresenter>(); _concentrationDim = A.Fake <IDimension>(); _timeDim = A.Fake <IDimension>(); _view = A.Fake <IIndividualPKAnalysisView>(); _pkaAnalysesTask = A.Fake <IPKAnalysesTask>(); _simulation = A.Fake <IndividualSimulation>(); _simulations = new List <Simulation>(); _simulations.Add(_simulation); _exportTask = A.Fake <IPKAnalysisExportTask>(); _individualPKAnalysisToDTOMapper = A.Fake <IIndividualPKAnalysisToPKAnalysisDTOMapper>(); _pkParameterRepository = A.Fake <IPKParameterRepository>(); ; var dataRepository = new DataRepository(); _baseGrid = new BaseGrid("Base", _timeDim); _col1 = new DataColumn { DataInfo = new DataInfo(ColumnOrigins.Calculation, AuxiliaryType.Undefined, "mg", string.Empty, 5), Dimension = _concentrationDim }; _col2 = new DataColumn { Dimension = _concentrationDim, DataInfo = new DataInfo(ColumnOrigins.Calculation, AuxiliaryType.Undefined, "mg", string.Empty, 5) }; _col3 = new DataColumn { Dimension = _concentrationDim, DataInfo = new DataInfo(ColumnOrigins.Calculation, AuxiliaryType.Undefined, "mg", string.Empty, 5) }; dataRepository.Add(_col1); dataRepository.Add(_col2); _simulation.DataRepository = dataRepository; var curve1 = A.Fake <Curve>(); A.CallTo(() => curve1.yData).Returns(_col1); A.CallTo(() => curve1.xData).Returns(_baseGrid); var curve2 = A.Fake <Curve>(); A.CallTo(() => curve2.yData).Returns(_col2); A.CallTo(() => curve2.xData).Returns(_baseGrid); var curve3 = A.Fake <Curve>(); A.CallTo(() => curve3.yData).Returns(_col3); A.CallTo(() => curve3.xData).Returns(_col1); _curves = new List <Curve> { curve1, curve2, curve3 }; _allPKAnalysis = new List <Tuple <DataColumn, PKAnalysis> >(); _pkAnalysis1 = createPKAnalysis(); _pkAnalysis2 = createPKAnalysis(); _allPKAnalysis.Add(new Tuple <DataColumn, PKAnalysis>(_col1, _pkAnalysis1)); _allPKAnalysis.Add(new Tuple <DataColumn, PKAnalysis>(_col2, _pkAnalysis2)); _allGlobalPKParameters = new List <IParameter>(); A.CallTo(_pkaAnalysesTask).WithReturnType <IEnumerable <Tuple <DataColumn, PKAnalysis> > >().Returns(_allPKAnalysis); A.CallTo(_pkaAnalysesTask).WithReturnType <IEnumerable <IParameter> >().Returns(_allGlobalPKParameters); _presenterSettingsTask = A.Fake <IPresentationSettingsTask>(); sut = new IndividualPKAnalysisPresenter(_view, _pkaAnalysesTask, _exportTask, _globalPKAnalysisPresenter, _individualPKAnalysisToDTOMapper, _pkParameterRepository, _presenterSettingsTask); }
protected override void Context() { base.Context(); _time = new Dimension(new BaseDimensionRepresentation { TimeExponent = 1 }, "Time", "s"); _time.AddUnit("min", 60, 0); _time.AddUnit("h", 3600, 0); _length = new Dimension(new BaseDimensionRepresentation { LengthExponent = 1 }, "Length", "m"); _length.AddUnit("mm", 0.001, 0.0); _mass = new Dimension(new BaseDimensionRepresentation { MassExponent = 1 }, "Mass", "kg"); _mass.AddUnit("mg", 0.000001, 0.0); _baseGrid1 = new BaseGrid("BaseGrid1", "BaseGrid1", _time); _baseGrid1.Values = new[] { 0, 1, 2.0F }; _baseGrid2 = new BaseGrid("BaseGrid2", "BaseGrid2", _time); _baseGrid1.Values = new[] { 0, 1, 2.0F, 3.0F }; _spA = new MoleculeAmount().WithName("A"); _obsB = new Observer().WithName("B"); sut = new DataRepository(); }
public Expression <Func <TEntity, bool> > GetGridExpression(BaseGrid <TEntity> grid) { var expression = PredicateHelper.True <TEntity>(); var customFilterExpression = grid.GetCustomFilterExpression(); if (customFilterExpression != null) { expression = expression.And(customFilterExpression); } var searchExpression = grid.GetSearchExpression(); if (searchExpression != null) { expression = expression.And(searchExpression); } foreach (var filter in grid.Filters.Where(q => q.HasSelectedData)) { var filterExpression = _filterStore.FilterExpressionGeneratorStrategies[filter.Type].GetFilterLinqExpression(filter); if (filterExpression != null) { expression = expression.And(filterExpression); } } return(expression); }
public void Reset(GridPos startPos, GridPos endPos, BaseGrid _searchGrid = null) { ResetInternal(startPos, endPos, _searchGrid); startNode = null; endNode = null; if (_searchGrid != null) { searchGrid = _searchGrid; } searchGrid.Reset(); startNode = searchGrid.GetNodeAt(startPos.X, startPos.Y); endNode = searchGrid.GetNodeAt(endPos.X, endPos.Y); if (startNode == null) { startNode = new Node(startPos.X, startPos.Y, true); } if (endNode == null) { endNode = new Node(endPos.X, endPos.Y, true); } }
public static DataColumn GetDataColumnFrom(string csvName) { var fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"Data\\{csvName}.csv"); var timeValues = new List <float>(); var concValues = new List <float>(); foreach (string line in File.ReadLines(fileName)) { var cells = line.Split(';'); timeValues.Add(float.Parse(cells[0], CultureInfo.InvariantCulture)); concValues.Add(float.Parse(cells[1], CultureInfo.InvariantCulture)); } var baseGrid = new BaseGrid( "Time", "Time", Constants.Dimension.NO_DIMENSION ) { Values = timeValues.ToArray() }; return (new DataColumn( "Value", csvName, Constants.Dimension.NO_DIMENSION, baseGrid ) { Values = concValues.ToArray() }); }
protected override void Context() { base.Context(); sut.EditParameterIdentification(_parameterIdentification); var baseGridBest = new BaseGrid("baseGridBest", DomainHelperForSpecs.TimeDimensionForSpecs()) { Values = new[] { 1f, 2f, 3f } }; _bestCol = new DataColumn("BEST", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), baseGridBest) { Values = new[] { 11f, 22f, 33f } }; var baseGridCurrent = new BaseGrid("baseGridCurrent", DomainHelperForSpecs.TimeDimensionForSpecs()) { Values = new[] { 4f, 5f, 6f, 7f } }; _currentCol = new DataColumn("CURRENT", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), baseGridCurrent) { Values = new[] { 41f, 51f, 61f, 71f } }; A.CallTo(() => _bestResult.SimulationResultFor(_outputMapping1.FullOutputPath)).Returns(_bestCol); A.CallTo(() => _currentResult.SimulationResultFor(_outputMapping1.FullOutputPath)).Returns(_currentCol); }
public void TestSerializationWithRelatedColumnExplicitelyBefore() { var baseGrid = new BaseGrid("Bastian", DimensionTime) { Values = new float[] { 0F, 3600F, 7200F } }; var x1 = new DataColumn("Columbus", DimensionLength, baseGrid) { IsInternal = false }; var relCol = new DataColumn("Renate", DimensionLess, baseGrid) { DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.GeometricStdDev, " ", new DateTime(2010, 10, 22), "Study1", "Dog", 2.4) }; x1.AddRelatedColumn(relCol); var dr1 = new DataRepository("id") { x1, relCol }; var dr2 = SerializeAndDeserialize(dr1); var x2 = dr2.AllButBaseGrid().First(x => x.IsNamed("Columbus")); AssertForSpecs.AreEqualMcDataColumn(x1, x2); x2.RelatedColumns.First().Dimension.ShouldNotBeNull(); }
public HexLine AddGridLine(Site origin, Site target, int lineId, BaseGrid grid) { var line = new HexLine(origin, target, lineId, Grid); GridLines.Add(lineId, line); return(line); }
private void MarkLine(GlobalFlags.GridLineTypes lineType, int lineIndex, bool needMassUpdate) { if (needMassUpdate) { BaseGrid.UpdateLayout(); BaseGrid.ScrollIntoView(BaseGrid.Items[lineIndex]); } var lvitem = BaseGrid.ItemContainerGenerator.ContainerFromIndex(lineIndex) as ListViewItem; if (lvitem != null) { switch (lineType) { case GlobalFlags.GridLineTypes.Error: Dispatcher.Invoke(new Action(() => lvitem.Foreground = Brushes.Red)); break; case GlobalFlags.GridLineTypes.Running: Dispatcher.Invoke(new Action(() => lvitem.Foreground = Brushes.Green)); break; case GlobalFlags.GridLineTypes.Done: Dispatcher.Invoke(new Action(() => lvitem.Foreground = Brushes.Gray)); break; case GlobalFlags.GridLineTypes.Ready: Dispatcher.Invoke(new Action(() => lvitem.Foreground = Brushes.Blue)); break; } } }
public void TestSerializationWithoutRelatedColumn() { var path = new List <string>(new string[] { "aa", "bb" }); var baseGrid = new BaseGrid("Bastian", DimensionTime) { Values = new float[] { 0F, 3600F, 7200F } }; var x1 = new DataColumn("Columbus", DimensionLength, baseGrid) { IsInternal = true, QuantityInfo = new QuantityInfo("Quain", path, QuantityType.Parameter), DataInfo = new DataInfo(ColumnOrigins.Observation, AuxiliaryType.Undefined, "cm", new DateTime(2010, 10, 22), "Study1", "Dog", 2.4), Values = new[] { 1.0F, 2.1F, -3.4F } }; x1.DataInfo.LLOQ = 1.0F; x1.DataInfo.ComparisonThreshold = 1e-2F; var dr1 = new DataRepository("id") { x1 }; var dr2 = SerializeAndDeserialize(dr1); var x2 = dr2.AllButBaseGrid().First(); AssertForSpecs.AreEqualMcDataColumn(x1, x2); }
protected override void Context() { _view = A.Fake <IDataRepositoryDataView>(); _dataRepositoryTask = A.Fake <IDataRepositoryExportTask>(); _commandCollector = A.Fake <ICommandCollector>(); sut = new DataRepositoryDataPresenter(_view, _dataRepositoryTask); sut.InitializeWith(_commandCollector); //common setup _dataRepository = new DataRepository(); _dataTable = new DataTable(); A.CallTo(() => _dataRepositoryTask.ToDataTable(_dataRepository, A <DataColumnExportOptions> ._)).Returns(new[] { _dataTable }); var col = _dataTable.AddColumn <float>("test"); col.ExtendedProperties.Add(Constants.DATA_REPOSITORY_COLUMN_ID, "col"); _baseGrid = new BaseGrid("base", "base", Constants.Dimension.NO_DIMENSION) { Values = new ArraySegment <float>() }; _dim = A.Fake <IDimension>(); _col = new DataColumn("col", "col", _dim, _baseGrid) { Values = new ArraySegment <float>() }; _dataRepository.Add(_baseGrid); _dataRepository.Add(_col); }
private DataColumn createWeightColumn(BaseGrid baseGrid, WeightedObservedData weightedObservedData) { return(new DataColumn(Captions.ParameterIdentification.Weight, _dimensionFactory.NoDimension, baseGrid) { Values = weightedObservedData.Weights }); }
private DataRepository dataForSelectedOntogeny(Unit xUnit, Unit yUnit) { var dataRepository = new DataRepository { Name = PKSimConstants.UI.OntogenyFor(_dto.SelectedOntogeny.DisplayName) }; var pma = new BaseGrid(PKSimConstants.UI.PostMenstrualAge, _dimensionRepository.AgeInYears) { DisplayUnit = xUnit }; var mean = new DataColumn(dataRepository.Name, _dimensionRepository.Fraction, pma) { DisplayUnit = yUnit }; var std = new DataColumn(PKSimConstants.UI.StandardDeviation, _dimensionRepository.Fraction, pma) { DisplayUnit = yUnit }; mean.DataInfo.AuxiliaryType = AuxiliaryType.GeometricMeanPop; std.AddRelatedColumn(mean); dataRepository.Add(mean); dataRepository.Add(std); var allOntogenies = _ontogenyRepository.AllValuesFor(_dto.SelectedOntogeny, _dto.SelectedContainer.Name).OrderBy(x => x.PostmenstrualAge).ToList(); pma.Values = values(allOntogenies, x => x.PostmenstrualAge); mean.Values = values(allOntogenies, x => x.OntogenyFactor); std.Values = values(allOntogenies, x => x.Deviation); return(dataRepository); }
protected override void Context() { _view = A.Fake <IParameterIdentificationChartFeedbackView>(); _chartDisplayPresenter = A.Fake <IChartDisplayPresenter>(); _dimensionFactory = A.Fake <IDimensionFactory>(); _predictedVsObservedChartService = A.Fake <IPredictedVsObservedChartService>(); _displayUnitRetriever = A.Fake <IDisplayUnitRetriever>(); _parameterIdentification = A.Fake <ParameterIdentification>(); _observationColumns = new List <DataColumn>(); _curveList = new List <Curve>(); _baseGrid = DomainHelperForSpecs.ObservedData().BaseGrid; _outputMapping = new OutputMapping(); sut = new ParameterIdentificationPredictedVsObservedFeedbackPresenter(_view, _chartDisplayPresenter, _dimensionFactory, _displayUnitRetriever, _predictedVsObservedChartService); A.CallTo(() => _parameterIdentification.AllOutputMappings).Returns(new[] { _outputMapping }); A.CallTo(() => _parameterIdentification.AllObservationColumnsFor(A <string> ._)).Returns(_observationColumns); _observationColumns.Add(new DataColumn()); _observationColumns.Add(new DataColumn()); A.CallTo(() => _predictedVsObservedChartService.AddCurvesFor(_observationColumns, A <DataColumn> ._, A <ParameterIdentificationPredictedVsObservedChart> ._, A <Action <DataColumn, Curve> > ._)).Invokes(x => { var action = x.Arguments.Get <Action <DataColumn, Curve> >(3); _observationColumns.Each(observation => { var curve = new Curve { Name = "Best" }; action(new DataColumn(ShortGuid.NewGuid(), A.Fake <IDimension>(), _baseGrid), curve); _curveList.Add(curve); }); _chart = x.GetArgument <ParameterIdentificationPredictedVsObservedChart>(2); }); }
public void TestSerializationWithRelatedColumnExplicitelyAfter() { var baseGrid = new BaseGrid("Bastian", DimensionTime) { Values = new float[] { 0F, 3600F, 7200F } }; var x1 = new DataColumn("Columbus", DimensionLength, baseGrid); var relColG = new DataColumn("RenateG", DimensionLess, baseGrid); relColG.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.GeometricStdDev, " ", new DateTime(2010, 10, 22), "Study1", "Dog", 2.4); x1.AddRelatedColumn(relColG); var relColA = new DataColumn("RenateA", DimensionLength, baseGrid); relColA.DataInfo = new DataInfo(ColumnOrigins.ObservationAuxiliary, AuxiliaryType.ArithmeticStdDev, "cm", new DateTime(2010, 10, 22), "Study1", "Dog", 2.4); x1.AddRelatedColumn(relColA); var dr1 = new DataRepository("id") { x1, relColG, relColA }; var dr2 = SerializeAndDeserialize(dr1); var x2 = dr2.AllButBaseGrid().First(x => x.IsNamed("Columbus")); AssertForSpecs.AreEqualMcDataColumn(x1, x2); }
public HexLine AddGridLine(Dimension dimension, Site origin, int lineId, BaseGrid grid) { var line = new HexLine(dimension, origin, lineId, Grid); GridLines.Add(lineId, line); return(line); }
protected override void Context() { base.Context(); _time = new Dimension(new BaseDimensionRepresentation { TimeExponent = 1 }, "Time", "s"); _time.AddUnit("min", 60, 0); _time.AddUnit("h", 3600, 0); _length = new Dimension(new BaseDimensionRepresentation { LengthExponent = 1 }, "Length", "m"); _length.AddUnit("mm", 0.001, 0); _mass = new Dimension(new BaseDimensionRepresentation { MassExponent = 1 }, "Mass", "kg"); _mass.AddUnit("mg", 0.000001, 0.0); _dimensionless = new Dimension(new BaseDimensionRepresentation(), "Dimensionless", " "); _baseGrid = new BaseGrid("BaseGrid", _time); _baseGrid.Values = new[] { -1.0F, 0.0F, 2.0F }; sut = new DataColumn("Colin", _length, _baseGrid); }
public TriangularLattice(BaseGrid grid, Orientation orientation, LatticeTypeEnum latticeType) { init(grid, orientation, latticeType); double xPos = -grid.OriginX + (Hex.UnitWidth / 2); double yPos = (_lineCount * Hex.UnitHeight / 2); int i = 0; double z = -Math.Floor(_lineCount / 2); while (yPos >= (-grid.OriginY)) { double x = calculateBaseXCoordinate(i); double y = -x - z; while (xPos <= (grid.OriginX)) { var labelText = siteId + ": " + x + ", " + y + ", " + z; var location = orientation == Orientation.Horizontal ? new CartesianCoord(xPos, yPos) : new CartesianCoord(yPos, xPos); createNewSite(latticeType, x, y, z, labelText, location); xPos += Hex.UnitWidth; x++; y--; } i++; xPos = (-grid.OriginX) + ((Hex.UnitWidth / 2) * (i % 2)); yPos -= Hex.UnitHeight; z++; } }
public MainWindow() { Stopwatch = new Stopwatch(); Stopwatch.Start(); TickCounts = new List <long>(); Lights = new List <HexLine>(); MainController = new MainController(); var initialisedServices = MainController.InitialiseServices(this); //DisplayService = initialisedServices.OfType<DisplayProgrammaticService>().FirstOrDefault(); //DisplayController = new DisplayController(); InitializeComponent(); loadPreviousSettings(); Tableau = new Canvas(); Grid = new BaseGrid(Height, Width, Tableau); Tableau.Width = Width; Tableau.Height = Height; Tableau.Background = Brushes.LightGray; Content = Tableau; var greenLattice = new TriangularLattice(Grid, Orientation.Horizontal, LatticeTypeEnum.Green, true); if (Hex.ShowGridLines) { createGridBuilder(greenLattice); } var testPoint = new Ellipse(); testPoint.Height = 20; testPoint.Width = 20; testPoint.Fill = Brushes.Chartreuse; //Grid.AddShape(testPoint, greenLattice.Sites[20].Location); Label = new TextBlock() { Text = "000.00", FontSize = 15 }; Canvas.SetLeft(Label, 500); Tableau.Children.Add(Label); //var label = new TextBlock() { Text = Period.ToString() }; //label. //Canvas.SetLeft(label,400); //Tableau.Children.Add(label); Lights.AddRange(greenLattice.GridLines.Values); //var redLattice = new TriangularLattice(Grid, Orientation.Horizontal, LatticeTypeEnum.Red); // var blueLattice = new TriangularLattice(Grid, Orientation.Horizontal, LatticeTypeEnum.Blue); // var blueLattice = new TriangularLattice(Grid, 20, Orientation.Vertical, LatticeTypeEnum.Blue); //var redLattice = new TriangularLattice(Grid,10, Orientation.Vertical, LatticeTypeEnum.Red); //var cellSize = 50; //var gridOrigin = new Coord(cellSize * 2, cellSize * 2); //var hGrid = new HexGrid(15, 15, cellSize, gridOrigin); //DrawGrid(hGrid,addVertexIds:true); //Console.WriteLine(hGrid.AllVertices.Count); //Console.WriteLine(hGrid.AllChannels.Count); Closing += mainWindowClosing; }
protected override void Context() { _oldName = "oldName"; _newName = "newName"; _timeDimension = new Dimension(new BaseDimensionRepresentation(), "Time", "min"); _concDimension = new Dimension(new BaseDimensionRepresentation(), "Conc", "mg/l"); _dataRepository = new DataRepository { Name = _oldName }; sut = new RenameObservedDataCommand(_dataRepository, _newName); _baseGrid = new BaseGrid("Time", _timeDimension); _column = new DataColumn("Col", _concDimension, _baseGrid); var quantityInfo = new QuantityInfo(_column.Name, new[] { _oldName, ObjectTypes.ObservedData, "Organ", "Compartment", "Drug", _column.Name }, QuantityType.Undefined); _baseGrid.QuantityInfo = new QuantityInfo("time", new[] { _oldName, ObjectTypes.ObservedData }, QuantityType.BaseGrid); _column.QuantityInfo = quantityInfo; _dataRepository.Add(_baseGrid); _dataRepository.Add(_column); _executionContext = A.Fake <IOSPSuiteExecutionContext>(); A.CallTo(() => _executionContext.Project.ObservedDataBy(_dataRepository.Id)).Returns(_dataRepository); _dataRepositoryNamer = A.Fake <IDataRepositoryNamer>(); A.CallTo(() => _executionContext.Resolve <IDataRepositoryNamer>()).Returns(_dataRepositoryNamer); }
private BaseGrid cloneBaseGrid(DataColumn baseGridToClone) { var newBaseGrid = new BaseGrid(baseGridToClone.Name, baseGridToClone.Dimension); updateColumnProperties(baseGridToClone, newBaseGrid); _idMap.Add(baseGridToClone.Id, newBaseGrid.Id); return(newBaseGrid); }
public DataColumn CloneColumn(DataColumn sourceColumn, BaseGrid clonedBaseGrid) { var newColumn = new DataColumn(sourceColumn.Name, sourceColumn.Dimension, clonedBaseGrid); updateColumnProperties(sourceColumn, newColumn); _idMap.Add(sourceColumn.Id, newColumn.Id); return(newColumn); }
public CreateDataForQuantityVisitor(DataRepository dataRepository, BaseGrid baseGrid, DateTime date, string source) { _dataRepository = dataRepository; _baseGrid = baseGrid; _date = date; _source = source; _n = 0; }
public DSCommandItemTemplate(bool enablePaging, bool enableExport, bool enableFilter, bool enableHeader, BaseGrid grid) { EnablePagingButtons = enablePaging; EnableExportButtons = enableExport; EnableFilterButtons = enableFilter; EnableHeaderSection = enableHeader; _grid = grid; }
public ParamBase(BaseGrid iGrid, DiagonalMovement iDiagonalMovement, HeuristicMode iMode) { SetHeuristic(iMode); m_searchGrid = iGrid; DiagonalMovement = iDiagonalMovement; m_startNode = null; m_endNode = null; }
public async Task <GridModel> GetGridAsync(BaseGrid <GameBase> baseGrid, CancellationToken ct = default) { Logger.LogInformation("Game games by grid {Grid}", baseGrid); GridModel grid = await UnitOfWork.GameRepository.GetPagedListAsync(_gameGridExpressionGenerator, baseGrid, ct); return(grid); }
protected DataColumn CalculationColumnFor(BaseGrid baseGrid, string organ, string compartment, string name, string compoundName) { var dataColumn = new DataColumn(name, A.Fake <IDimension>(), baseGrid); dataColumn.DataInfo.Origin = ColumnOrigins.Calculation; dataColumn.QuantityInfo.Type = QuantityType.Drug; dataColumn.QuantityInfo.Path = new[] { organ, compartment, compoundName }; return(dataColumn); }
protected ParamBase(BaseGrid iGrid, DiagonalMovement iDiagonalMovement, HeuristicMode iMode) { SetHeuristic(iMode); MsearchGrid = iGrid; DiagonalMovement = iDiagonalMovement; MstartNode = null; MendNode = null; }
protected override void Context() { base.Context(); _repository = new DataRepository("id"); var baseGrid = new BaseGrid("baseGridId", new Dimension(new BaseDimensionRepresentation(), "dimName", "baseUnit")); _repository.Add(baseGrid); _repository.Add(new DataColumn("column", new Dimension(new BaseDimensionRepresentation(), "dimName", "baseUnit"), baseGrid)); }
public Map(int width, int height) { _mapLayout = new Tile[width, height]; _searchGrid = new StaticGrid(width, height); _width = width; _height = height; jpParam = new JumpPointParam(null, true, false, false); _tileObjects = new List <TileObject>(); }
//string on_trobo="3,2"; //string on_vaig="7,9"; // Use this for initialization //void Start () { //Caminable(); //List<GridPos> ruta=Ruta_a(on_trobo,on_vaig); //foreach(GridPos cosa in ruta) //{ // Instantiate(marca_ruta, new Vector2(cosa.x * 2.5f, cosa.y * 2.5f), Quaternion.identity); //} //} //void Start () //{ // pos_0 = new Vector2(0,0); //} public void Crear_pathfinding_grid() { var matriu_bloqueig = new bool[map.Width][]; for (var ampleTrav = 0; ampleTrav < map.Width; ampleTrav++) { matriu_bloqueig[ampleTrav] = new bool[map.Height]; for (var alturaTrav = 0; alturaTrav < map.Height; alturaTrav++) { if (map[ampleTrav, alturaTrav] != 0) { // Instantiate(Bestiari.Generar["blue"], Grid_Vector(new GridPos(ampleTrav, alturaTrav)), Quaternion.identity); matriu_bloqueig[ampleTrav][alturaTrav] = true; if (map[ampleTrav, alturaTrav] < 3)llocs_disponibles.Add(new GridPos(ampleTrav, alturaTrav)); } //else Instantiate(Bestiari.Generar["red"], Grid_Vector(new GridPos(ampleTrav, alturaTrav)), Quaternion.identity); } } mapa_pa_sala = new StaticGrid(map.Width, map.Height, matriu_bloqueig); }