コード例 #1
0
    public void UpdatePlantBiomassOneElementDictionaryFractions()
    {
        float     Y  = 0.3f;
        BiomeGrid bg = new BiomeGrid();

        BiomeGrid.GroundTile tile = new BiomeGrid.GroundTile();
        tile.plantSpatial       = new Spatial();
        tile.plantSpatial.Scale = new Vector3(Y, 0, 0);
        tile.hasPlant           = true;
        bg.GetGroundTiles().Add(new Vector3(0, 0, 0), tile);
        bg.UpdatePlantBiomass();
        Assert.IsEqual(0.3f, bg.GetPlantBiomassArray()[0], "Then it passes");
    }
コード例 #2
0
    public void UpdatePlantBiomassMultiElementDictionaryFractions()
    {
        int       X  = 3;
        float     Y  = 0.3f;
        float     Z  = 0.3f + 0.3f + 0.3f;
        BiomeGrid bg = new BiomeGrid();

        for (int i = 0; i < X; i++)
        {
            BiomeGrid.GroundTile tile = new BiomeGrid.GroundTile();
            tile.plantSpatial       = new Spatial();
            tile.plantSpatial.Scale = new Vector3(Y, 0, 0);
            tile.hasPlant           = true;
            bg.GetGroundTiles().Add(new Vector3(i, 0, 0), tile);
        }
        bg.UpdatePlantBiomass();
        Assert.IsEqual(Z, bg.GetPlantBiomassArray()[0], "Then it passes");
    }
コード例 #3
0
    public void SaveFromNotEmptyArray()
    {
        const int X  = 1;
        const int Y  = 14;
        BiomeGrid bg = new BiomeGrid();

        BiomeGrid.GroundTile newTile = new BiomeGrid.GroundTile();
        newTile.type            = BiomeGrid.BiomeType.grassland;
        newTile.plantSpatial    = (Spatial) new Spatial();
        newTile.plantGrowthTime = 0f;
        newTile.EatersCount     = 0;
        newTile.isPlantGrowing  = false;
        newTile.hasPlant        = false;
        newTile.gridIndex       = new Vector3(0, 0, 0);
        bg.GetGroundTiles().Add(newTile.gridIndex, newTile);
        Assert.IsEqual(X, bg.Save().Count, "Then it passes");
        Assert.IsTrue(bg.Save()[0] is Godot.Collections.Dictionary, "Then it passes");
        Assert.IsEqual(Y, ((Godot.Collections.Dictionary)bg.Save()[0]).Count, "Then it passes");
    }