コード例 #1
0
    void Explore(Vector3 position)
    {
        Vector2 quadIndex = _plane.GetPolygonIndexFromPosition(position);

        int indexX = (int)quadIndex.x;
        int indexY = (int)quadIndex.y;

        if (_lastExploredIndex.x == indexX && _lastExploredIndex.y == indexY)
        {
            //don't update
        }
        else
        {
            UpdatePolygonColorAtIndex(indexX, indexY, explorerRangeX + 1, explorerRangeY + 1, 64, true);
            UpdatePolygonColorAtIndex(indexX, indexY, explorerRangeX, explorerRangeY, 0, false);

            UpdatePolygonColorAtIndex(indexX, indexY, explorerRangeX + 3, explorerRangeY, 64, true);
            UpdatePolygonColorAtIndex(indexX, indexY, explorerRangeX + 2, explorerRangeY - 1, 0, false);

            UpdatePolygonColorAtIndex(indexX, indexY, explorerRangeX, explorerRangeY + 2, 64, true);
            UpdatePolygonColorAtIndex(indexX, indexY, explorerRangeX - 1, explorerRangeY + 1, 0, false);

            _mesh.colors32 = _plane.getColors();

            _lastExploredIndex.Set(indexX, indexY);
        }
    }