Пример #1
0
        private void updateMaterialSet()
        {
            _currentMaterialSetIndex = ((_currentMaterialSetIndex % _materialSetCount) + _materialSetCount) % _materialSetCount;

            _materialDropdown.value = (_currentMaterialSetIndex + 1);

            MaterialSet materialSet = _materialSetCollection.materialSets[_currentMaterialSetIndex];
            string      logInfo     = MaterialSetUtility.MapMaterialSetToGameObjects(materialSet, _diceAsGameObjects);

            if (logInfo != null)
            {
                Debug.Log(logInfo);
            }
            else
            {
                Debug.Log("Done processing, for more info, define the MSUD_ON scripting symbol in the player settings.");
            }
        }
Пример #2
0
        private void doMaterialSetDropAreaGUI()
        {
            Event evt = Event.current;
            Rect drop_area = GUILayoutUtility.GetRect(0.0f, 50.0f, GUILayout.ExpandWidth(true));
            GUI.Box(drop_area, "Drag a MaterialSet here", _centeredBox);

            switch (evt.type)
            {
                case EventType.DragUpdated:
                    if (!drop_area.Contains(evt.mousePosition)) return;
                    if (DragAndDrop.objectReferences.Length != 1) return;
                    if (!(DragAndDrop.objectReferences[0] is MaterialSet)) return;
                    DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
                    DragAndDrop.AcceptDrag();
                    break;

                case EventType.DragPerform:
                    MaterialSet materialSet = DragAndDrop.objectReferences[0] as MaterialSet;
                    GameObject[] dice = targets.Select(x => (x as DieSides).gameObject).ToArray<GameObject>();
                    _materialInfo = MaterialSetUtility.MapMaterialSetToGameObjects(materialSet, dice);
                    EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
                    break;
            }
        }