GetData() protected abstract méthode

protected abstract GetData ( ) : void
Résultat void
        public IActionResult Get([FromBody] ExperimentsSettings settings)
        {
            List <Data> data         = new List <Data>();
            var         currentValue = settings.StartCount;

            var generator = new Generator();

            while (currentValue < settings.FinishCount)
            {
                for (int i = 0; i < settings.Count; i++)
                {
                    var tempData = generator.GetData(currentValue);
                    data.Add(tempData);
                }
                currentValue += settings.Step;
            }

            return(new JsonResult(data));
        }
Exemple #2
0
    public Voxel GetData(int x, int y, int z, int adjIndex)
    {
        Vector3Int chunkPos = position;

        if (x < 0)
        {
            chunkPos.x--;
        }
        else if (x >= size.x)
        {
            chunkPos.x++;
        }
        if (y < 0)
        {
            chunkPos.y--;
        }
        else if (y >= size.y)
        {
            chunkPos.y++;
        }
        if (z < 0)
        {
            chunkPos.z--;
        }
        else if (z >= size.z)
        {
            chunkPos.z++;
        }

        if (chunkPos == position)
        {
            return(datas[x, y, z]);
        }

        return(generator.GetData(chunkPos, x, y, z, adjIndex));
    }
Exemple #3
0
        public IActionResult Get()
        {
            var interval = new Interval(() => _hub.Clients.All.SendAsync("publishSalesData", Generator.GetData()));

            return(Ok(new { Message = "Ok" }));
        }
Exemple #4
0
    void Start()
    {
        _entitiesInGame = new List <Entity> ();


        _baseLayer    = new TileLayer(width, height);
        _overlayLayer = new TileLayer(width, height);

        _tileLayers    = new TileLayer[2];
        _tileLayers[0] = _baseLayer;
        _tileLayers[1] = _overlayLayer;

        mapGenerator = GetComponent <Generator> ();
        mapGenerator.LoadGenerationData(width, height);


        _entitiesInTiles = new List <Entity> [width, height];
        for (int x = 0; x < _entitiesInTiles.GetLength(0); x++)
        {
            for (int y = 0; y < _entitiesInTiles.GetLength(1); y++)
            {
                _entitiesInTiles[x, y] = new List <Entity> ();
            }
        }


        for (int y = 0; y < _baseLayer.Height; y++)
        {
            for (int x = 0; x < _baseLayer.Width; x++)
            {
                float value = mapGenerator.GetData(x, y);

                Tile t = TileDatabase.GRASS;

                if (value < 0.2f)
                {
                    t = TileDatabase.SHALLOW_WATER;
                }
                else if (value < 0.3f)
                {
                    t = TileDatabase.SAND;
                }
                else if (value < 0.4f)
                {
                    t = TileDatabase.DIRT;
                }
                else
                {
                    t = TileDatabase.GRASS;
                }



                SetTileOnLayer((float)x, (float)y, t, 0, 0);

                if (t.ID != TileDatabase.SHALLOW_WATER_ID)
                {
                    if (Random.Range(0, 101) <= 5)
                    {
                        SetTile((float)x, (float)y, TileDatabase.ROCK, 0);
                    }
                }

                if (t.ID == TileDatabase.GRASS_ID)
                {
                    if (Random.Range(0, 101) <= 10)
                    {
                        SetTile((float)x, (float)y, TileDatabase.GRASS_BUSH, 0);
                    }
                }
            }
        }
    }