Exemplo n.º 1
0
        protected virtual void DrawTool(Ray drawPointRay)
        {
            if (attribute != null)
            {
                toolColor = ToolColorAttribute.GetColor(attribute.toolUseType);
            }
            RaycastHit drawPointHit;

            if (Physics.Raycast(drawPointRay, out drawPointHit, Mathf.Infinity, ~(GetParameter <Ignore>().layer)))
            {
                if ((Event.current.type == EventType.MouseDown || Event.current.type == EventType.MouseDrag) && Event.current.button == 0)
                {
                    if (Event.current.type == EventType.MouseDown)
                    {
                        OnStartPaint(drawPointHit);
                    }
                    Paint(drawPointHit);
                }
                if (Event.current.type == EventType.MouseUp && Event.current.button == 0)
                {
                    OnEndPaint(drawPointHit);
                }
            }
            OnDrawTool?.Invoke(drawPointHit);
        }
Exemplo n.º 2
0
        public static void Init(Vector2 pos)
        {
            PrefabshopSettings window = EditorWindow.GetWindow <PrefabshopSettings>();

            window.minSize = new Vector2(320, 420);
            GUIContent titleContent = new GUIContent("Prefabshop Settings");

            window.titleContent = titleContent;
            window.Show();
            Rect windowRect = new Rect(pos, window.position.size);

            window.position = windowRect;

            var types = Assembly.GetExecutingAssembly().GetTypes();

            window.tools = (from System.Type type in types where type.IsSubclassOf(typeof(Tool)) select type).ToArray();

            window.paint  = ToolColorAttribute.GetColor(ToolColorAttribute.ToolUseType.Paint);
            window.remove = ToolColorAttribute.GetColor(ToolColorAttribute.ToolUseType.Remove);
            window.other  = ToolColorAttribute.GetColor(ToolColorAttribute.ToolUseType.Other);
        }