public void ContainsTwoColors()
        {
            var texture = new PerlinNoiseTexture(Colors.White, Colors.Black);

            texture.A.Should().Be(Colors.White);
            texture.B.Should().Be(Colors.Black);
        }
        public void MixesTwoColors()
        {
            var texture = new PerlinNoiseTexture(Colors.White, Colors.Black);
            var c1      = texture.LocalColorAt(new Point(0, 0, 0));
            var c2      = texture.LocalColorAt(new Point(0.2f, 0.3f, 0.4f));
            var c3      = texture.LocalColorAt(new Point(0.2f, 0.3f, 0.5f));

            CheckForValidGray(c1);
            CheckForValidGray(c2);
            CheckForValidGray(c3);
            c1.Should().NotBe(c2);
            c1.Should().NotBe(c3);
        }
示例#3
0
    void OnEnable()
    {
        var texture = new Texture2D(256, 256);

        texture.wrapMode   = TextureWrapMode.Clamp;
        texture.filterMode = FilterMode.Point;
        PerlinNoiseTexture.ApplyLegacy(texture);

        var mat = new Material(Shader.Find("Unlit/Texture"));

        mat.mainTexture = texture;

        var mr = GetComponent <MeshRenderer>();

        mr.material = mat;
    }
    void Start()
    {
        tileMap = GetComponent <Tilemap>();
        texture = GetComponent <PerlinNoiseTexture>();
        grid    = FindObjectOfType <Grid>();

        centerPoint[0] = new List <Vector2Int>();
        centerPoint[1] = new List <Vector2Int>();

        if (grid != null)
        {
            grid = grid.GetComponent <Grid>();
            transform.position = new Vector3(transform.position.x - (grid.cellSize.x / 2f),
                                             transform.position.y - grid.cellSize.y, transform.position.z);
        }

        _tileOccurrence = CheckColorIntensity(_tileOccurrence);
        _pixelSize      = CheckPixelSize(_pixelSize);
        PlaceGroundTiles(_tile[0], _tile[1]);
    }