Exemplo n.º 1
0
        public override void OnExitToolMode(BrushShortcutHandler <BrushShortcutType> shortcutHandler)
        {
            SetEditorPrefs("TerrainBrushSize", m_BrushSize.value);
            SetEditorPrefs("TerrainBrushSizeMouseSensitivity", m_BrushSize.mouseSensitivity);
            SetEditorPrefs("TerrainBrushSizeJitter", m_JitterHandler.jitter);
            SetEditorPrefs("TerrainBrushSizeMin", m_BrushSize.minValue);
            SetEditorPrefs("TerrainBrushSizeMax", m_BrushSize.maxValue);
            shortcutHandler.RemoveActions(BrushShortcutType.Size);

            EndAdjustingSize();

            base.OnExitToolMode(shortcutHandler);
        }
Exemplo n.º 2
0
        public override void OnExitToolMode(BrushShortcutHandler <BrushShortcutType> shortcutHandler)
        {
            shortcutHandler.RemoveActions(BrushShortcutType.Rotation);

            SetEditorPrefs("TerrainBrushRotation", m_BrushRotation.value);
            SetEditorPrefs("TerrainBrushRotMouseSensitivity", m_BrushRotation.mouseSensitivity);
            SetEditorPrefs("TerrainBrushRotJitter", m_JitterHandler.jitter);
            SetEditorPrefs("TerrainBrushRotFollowMouse", m_FollowMouse);

            EndAdjustingRotation();

            base.OnExitToolMode(shortcutHandler);
        }
Exemplo n.º 3
0
        public override void OnExitToolMode(BrushShortcutHandler <BrushShortcutType> shortcutHandler)
        {
            SetEditorPrefs("TerrainBrushStrength", m_BrushStrength.value);
            SetEditorPrefs("TerrainBrushStrengthMouseSensitivity", m_BrushStrength.mouseSensitivity);
            SetEditorPrefs("TerrainBrushRandomStrength", m_JitterHandler.jitter);
            SetEditorPrefs("TerrainBrushStrengthMin", m_BrushStrength.minValue);
            SetEditorPrefs("TerrainBrushStrengthMax", m_BrushStrength.maxValue);

            shortcutHandler.RemoveActions(BrushShortcutType.Strength);

            EndAdjustingStrength();

            base.OnExitToolMode(shortcutHandler);
        }
Exemplo n.º 4
0
        public override void OnEnterToolMode(BrushShortcutHandler <BrushShortcutType> shortcutHandler)
        {
            base.OnEnterToolMode(shortcutHandler);

            if (!canUpdateTerrainUnderCursor)
            {
                UnlockTerrainUnderCursor();
            }

            shortcutHandler.AddActions(BrushShortcutType.Strength, BeginAdjustingStrength, EndAdjustingStrength);

            m_BrushStrength.value    = GetEditorPrefs("TerrainBrushStrength", defaultBrushStrength);
            m_JitterHandler.jitter   = GetEditorPrefs("TerrainBrushRandomStrength", 0.0f);
            m_BrushStrength.minValue = GetEditorPrefs("TerrainBrushStrengthMin", 0.0f);
            m_BrushStrength.maxValue = GetEditorPrefs("TerrainBrushStrengthMax", 1.0f);
        }
Exemplo n.º 5
0
        public override void OnEnterToolMode(BrushShortcutHandler <BrushShortcutType> shortcutHandler)
        {
            base.OnEnterToolMode(shortcutHandler);

            m_BrushRotation.value            = GetEditorPrefs("TerrainBrushRotation", kDefaultBrushRotation);
            m_BrushRotation.mouseSensitivity =
                GetEditorPrefs("TerrainBrushRotMouseSensitivity", kDefaultMouseSensitivity);
            m_JitterHandler.jitter = GetEditorPrefs("TerrainBrushRotJitter", 0.0f);
            m_FollowMouse          = GetEditorPrefs("TerrainBrushRotFollowMouse", false);

            if (!canUpdateTerrainUnderCursor)
            {
                UnlockTerrainUnderCursor();
            }

            shortcutHandler.AddActions(BrushShortcutType.Rotation, BeginAdjustingRotation, EndAdjustingRotation);

            UpdateCurrentRotation(m_BrushRotation.value);
        }
Exemplo n.º 6
0
        public override void OnEnterToolMode(BrushShortcutHandler <BrushShortcutType> shortcutHandler)
        {
            base.OnEnterToolMode(shortcutHandler);

            if (!canUpdateTerrainUnderCursor)
            {
                UnlockTerrainUnderCursor();
            }

            shortcutHandler.AddActions(BrushShortcutType.Size, BeginAdjustingSize, EndAdjustingSize);

            float minBrushWorldSize, maxBrushWorldSize;
            float mininumTerrainSize   = float.MaxValue;
            int   maxTextureResolution = 0;

            foreach (var terrain in Terrain.activeTerrains)
            {
                var terrainData = terrain.terrainData;
                maxTextureResolution = Mathf.Max(maxTextureResolution, terrainData.heightmapResolution);
                mininumTerrainSize   = Mathf.Min(mininumTerrainSize, terrainData.size.x, terrainData.size.z);
            }
            // caculate the minimum / maximum brush ranges from a set of selected terrains
            TerrainPaintUtility.GetBrushWorldSizeLimits(out minBrushWorldSize, out maxBrushWorldSize, mininumTerrainSize, maxTextureResolution);
            m_BrushSize.shouldClampMax = false;
            m_BrushSize.shouldClampMin = false;
            m_BrushSize.maxClamp       = maxBrushWorldSize;
            m_BrushSize.minClamp       = minBrushWorldSize;
            m_BrushSize.shouldClampMax = true;
            m_BrushSize.shouldClampMin = true;

            m_BrushSize.value    = GetEditorPrefs("TerrainBrushSize", kDefaultBrushSize);
            m_BrushSize.minValue = GetEditorPrefs("TerrainBrushSizeMin", 0.0f);
            m_BrushSize.maxValue = GetEditorPrefs("TerrainBrushSizeMax", 500.0f);
            //m_BrushSize.mouseSensitivity = GetEditorPrefs("TerrainBrushSizeMouseSensitivity", kDefaultMouseSensitivity);
            m_JitterHandler.jitter = GetEditorPrefs("TerrainBrushSizeJitter", 0.0f);
        }
 public override void OnExitToolMode(BrushShortcutHandler <BrushShortcutType> shortcutHandler)
 {
     SetEditorPrefs("TerrainBrushScatter", m_BrushScatter);
     base.OnExitToolMode(shortcutHandler);
 }
 public override void OnEnterToolMode(BrushShortcutHandler <BrushShortcutType> shortcutHandler)
 {
     base.OnEnterToolMode(shortcutHandler);
     m_BrushScatter = GetEditorPrefs("TerrainBrushScatter", 0.0f);
 }