Пример #1
0
    private void OnPointerDown(Vector3 pos)
    {
        Vector2 pos2 = new Vector2(pos.x, pos.z);

        if (pos.x < 0)
        {
            return;
        }

        if (terrainManager)
        {
            MethodInfo             maskMethod = typeof(TestMask).GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static).Where(item => Attribute.IsDefined(item, typeof(StaticMaskFunkAttribute))).ToList()[0];
            TerrainBrushParameters parameters = new TerrainBrushParameters(Rect.MinMaxRect(
                                                                               (pos2.x - r) > 0?pos2.x - r:terrainManager.terrainRect.xMin,
                                                                               (pos2.y - r) > 0?pos2.y - r:terrainManager.terrainRect.yMin,
                                                                               (pos2.x + r) > 0?pos2.x + r:terrainManager.terrainRect.xMax,
                                                                               (pos2.y + r) > 0?pos2.y + r:terrainManager.terrainRect.yMax), maskMethod);

            terrainManager.ApplyHeightBrush(parameters, typeof(TestHeightBrush), null);
        }
    }