private void Awake()
        {
            m_terrainEditor = GetComponentInParent <TerrainEditor>();
            m_editor        = IOC.Resolve <IRTE>();
            m_editor.Selection.SelectionChanged     += OnEditorSelectionChanged;
            m_terrainCutoutRenderer                  = IOC.Resolve <ITerrainCutoutMaskRenderer>();
            m_terrainCutoutRenderer.ObjectImageLayer = m_editor.CameraLayerSettings.ResourcePreviewLayer;

            m_source = FindObjectOfType <TerrainBrushSource>();
            if (m_source == null)
            {
                m_source = new GameObject("TerrainBrushSource").AddComponent <TerrainBrushSource>();
            }

            if (m_brushesList != null)
            {
                m_brushesList.SelectionChanged += OnBrushesSelectionChanged;
                m_brushesList.ItemDataBinding  += OnBrushesDataBinding;
                m_brushesList.CanDrag           = false;
                m_brushesList.CanEdit           = false;
                m_brushesList.CanRemove         = false;
                m_brushesList.CanReorder        = false;
                m_brushesList.CanReparent       = false;
                m_brushesList.CanSelectAll      = false;
                m_brushesList.CanUnselectAll    = false;
            }

            if (m_brushSizeEditor != null)
            {
                BrushSize = 2.5f;

                m_brushSizeEditor.Min = 0.5f;
                m_brushSizeEditor.Max = 40;
                m_brushSizeEditor.Init(this, this, Strong.MemberInfo((TerrainBrushEditor x) => x.BrushSize));
            }

            if (m_opacityEditor != null)
            {
                BrushOpacity = 100;

                m_opacityEditor.Min = 0;
                m_opacityEditor.Max = 100;
                m_opacityEditor.Init(this, this, Strong.MemberInfo((TerrainBrushEditor x) => x.BrushOpacity));
            }

            if (m_createButton != null)
            {
                m_createButton.onClick.AddListener(OnCreateButtonClick);
            }

            if (m_addButton != null)
            {
                m_addButton.onClick.AddListener(OnAddButtonClick);
            }

            if (m_deleteButton != null)
            {
                m_deleteButton.onClick.AddListener(OnDeleteButtonClick);
            }
        }
Esempio n. 2
0
        protected virtual void Awake()
        {
            m_terrainEditor = GetComponentInParent <TerrainEditor>();

            if (m_terrainBrushEditor != null)
            {
                m_terrainBrushEditor.SelectedBrushChanged += OnSelectedBrushChanged;
                m_terrainBrushEditor.BrushParamsChanged   += OnBrushParamsChanged;
            }
        }
        private void Awake()
        {
            m_terrainEditor = GetComponentInParent <TerrainEditor>();
            m_terrainEditor.TerrainChanged += OnTerrainChanged;

            if (m_terrainBrushEditor != null)
            {
                m_terrainBrushEditor.SelectedBrushChanged += OnSelectedBrushChanged;
                m_terrainBrushEditor.BrushParamsChanged   += OnBrushParamsChanged;
            }
        }
        private void Awake()
        {
            m_editor = IOC.Resolve <IRuntimeEditor>();

            m_terrainEditor = GetComponentInParent <TerrainEditor>();
            m_terrainEditor.TerrainChanged += OnTerrainChanged;

            m_terrainTool = IOC.Resolve <ITerrainTool>();

            m_editor.Selection.SelectionChanged += OnSelectionChanged;

            m_commandsList.ItemClick       += OnItemClick;
            m_commandsList.ItemDataBinding += OnItemDataBinding;
            m_commandsList.ItemExpanding   += OnItemExpanding;
            m_commandsList.ItemBeginDrag   += OnItemBeginDrag;
            m_commandsList.ItemDrop        += OnItemDrop;
            m_commandsList.ItemDragEnter   += OnItemDragEnter;
            m_commandsList.ItemDragExit    += OnItemDragExit;
            m_commandsList.ItemEndDrag     += OnItemEndDrag;

            m_commandsList.CanEdit        = false;
            m_commandsList.CanReorder     = false;
            m_commandsList.CanReparent    = false;
            m_commandsList.CanSelectAll   = false;
            m_commandsList.CanUnselectAll = true;
            m_commandsList.CanRemove      = false;

            if (m_xSpacingEditor != null)
            {
                m_xSpacingEditor.Min = 5;
                m_xSpacingEditor.Max = 40;
                m_xSpacingEditor.Init(m_terrainTool, m_terrainTool, Strong.PropertyInfo((ITerrainTool x) => x.XSpacing), null, "X Space");
            }

            if (m_zSpacingEditor != null)
            {
                m_zSpacingEditor.Min = 5;
                m_zSpacingEditor.Max = 40;
                m_zSpacingEditor.Init(m_terrainTool, m_terrainTool, Strong.PropertyInfo((ITerrainTool x) => x.ZSpacing), null, "Z Space");
            }

            if (m_zTestEditor != null)
            {
                m_zTestEditor.Init(m_terrainTool, m_terrainTool, Strong.PropertyInfo((ITerrainTool x) => x.EnableZTest), null, "Z Test");
            }

            if (m_handlesToggle != null)
            {
                m_handlesToggle.onValueChanged.AddListener(OnHandlesToggleValueChanged);
            }
        }
Esempio n. 5
0
        protected virtual void Awake()
        {
            m_localization    = IOC.Resolve <ILocalization>();
            m_terrainSettings = IOC.Resolve <ITerrainSettings>();

            m_terrainEditor = GetComponentInParent <TerrainEditor>();
            m_terrainEditor.TerrainChanged += OnTerrainChanged;

            if (m_texturePicker != null)
            {
                m_terrainSettings.InitTexturePicker(m_texturePicker, Strong.PropertyInfo((ITerrainSettings x) => x.DefaultTexture));
                m_texturePicker.TextureChanged += OnDefaultTextureChanged;
            }
        }
Esempio n. 6
0
        protected virtual void Awake()
        {
            m_terrainEditor = GetComponentInParent <TerrainEditor>();
            m_terrainEditor.TerrainChanged += OnTerrainChanged;

            m_terrainBrushEditor.BrushOpacity = PlayerPrefs.GetInt(GetType().FullName + ".BrushOpacity", m_terrainBrushEditor.BrushOpacity);
            m_terrainBrushEditor.BrushSize    = PlayerPrefs.GetFloat(GetType().FullName + ".BrushSize", m_terrainBrushEditor.BrushSize);

            if (m_terrainBrushEditor != null)
            {
                m_terrainBrushEditor.SelectedBrushChanged += OnSelectedBrushChanged;
                m_terrainBrushEditor.BrushParamsChanged   += OnBrushParamsChanged;
            }
        }
Esempio n. 7
0
        private void Awake()
        {
            m_terrainEditor = GetComponentInParent <TerrainEditor>();

            if (m_terrainLayerEditor != null)
            {
                m_terrainLayerEditor.TerrainData           = m_terrainEditor.Terrain.terrainData;
                m_terrainLayerEditor.SelectedLayerChanged += OnSelectedLayerChanged;
            }

            if (m_terrainBrushEditor != null)
            {
                m_terrainBrushEditor.SelectedBrushChanged += OnSelectedBrushChanged;
                m_terrainBrushEditor.BrushParamsChanged   += OnBrushParamsChanged;
            }
        }