Пример #1
0
    public override void OnEnable()
    {
        base.OnEnable();

        _lastSave = DateTime.Now;

        DrawTool = new PaintTool(this, null);

        UnityInternal.AddGlobalEventHandler(GlobalInputHack);
        EditorApplication.hierarchyWindowChanged += OnHierachyChange;

        _drawTileSetWindow = new DrawTileSetWindow(this);
        _brushWindow = new BrushWindow(this);

        RefreshMaps();

        var cameraGo = GameObject.Find("TilerCamera");
        if (cameraGo == null)
        {
            cameraGo = EditorUtility.CreateGameObjectWithHideFlags("TilerCamera", (HideFlags)13, new[] { typeof(Camera) });
            cameraGo.AddComponent<GUILayer>();
            cameraGo.AddComponent<FlareLayer>();
            UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(cameraGo, "Assets/Tiler/Editor/Windows/Main/Draw/DrawWindow.cs (78,13)", "HaloLayer");
        }
        _camera = cameraGo.GetComponent<Camera>();
        _camera.enabled = false;
        _height = Mathf.Log(16);
        _camera.transform.eulerAngles = new Vector3(90, 0, 0);
        SetCameraHeight();

        var lightGo = GameObject.Find("TilerLight");
// ReSharper disable ConvertIfStatementToNullCoalescingExpression
        if (lightGo == null)
// ReSharper restore ConvertIfStatementToNullCoalescingExpression
            lightGo = EditorUtility.CreateGameObjectWithHideFlags("TilerLight", (HideFlags) 13, new[] {typeof (Light)});

        _light = lightGo.GetComponent<Light>();
        _light.type = LightType.Directional;
        _light.intensity = 0.5f;
        _light.enabled = false;

        var textGo = GameObject.Find("TilerText");
        if (textGo == null)
        {
            textGo = EditorUtility.CreateGameObjectWithHideFlags("TilerText", (HideFlags) 13, new[] {typeof (GUIText)});
            textGo.transform.position = new Vector3(0.5f, 1, 0);
        }

        
        _text = textGo.GetComponent<GUIText>();
        _text.anchor = TextAnchor.UpperCenter;
        _text.alignment = TextAlignment.Center;
        //_text.font.material.color = Color.white;
        //_text.text = "Remember to save. Last save more than 10 minutes ago.";
        _text.enabled = false;
    }
Пример #2
0
    public override void OnEnable()
    {
        base.OnEnable();

        _lastSave = DateTime.Now;

        DrawTool = new PaintTool(this, null);

        UnityInternal.AddGlobalEventHandler(GlobalInputHack);
        EditorApplication.hierarchyWindowChanged += OnHierachyChange;

        _drawTileSetWindow = new DrawTileSetWindow(this);
        _brushWindow       = new BrushWindow(this);

        RefreshMaps();

        var cameraGo = GameObject.Find("TilerCamera");

        if (cameraGo == null)
        {
            cameraGo = EditorUtility.CreateGameObjectWithHideFlags("TilerCamera", (HideFlags)13, new[] { typeof(Camera) });
            cameraGo.AddComponent <GUILayer>();
            cameraGo.AddComponent <FlareLayer>();
            UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(cameraGo, "Assets/Tiler/Editor/Windows/Main/Draw/DrawWindow.cs (78,13)", "HaloLayer");
        }
        _camera         = cameraGo.GetComponent <Camera>();
        _camera.enabled = false;
        _height         = Mathf.Log(16);
        _camera.transform.eulerAngles = new Vector3(90, 0, 0);
        SetCameraHeight();

        var lightGo = GameObject.Find("TilerLight");

// ReSharper disable ConvertIfStatementToNullCoalescingExpression
        if (lightGo == null)
        {
// ReSharper restore ConvertIfStatementToNullCoalescingExpression
            lightGo = EditorUtility.CreateGameObjectWithHideFlags("TilerLight", (HideFlags)13, new[] { typeof(Light) });
        }

        _light           = lightGo.GetComponent <Light>();
        _light.type      = LightType.Directional;
        _light.intensity = 0.5f;
        _light.enabled   = false;

        var textGo = GameObject.Find("TilerText");

        if (textGo == null)
        {
            textGo = EditorUtility.CreateGameObjectWithHideFlags("TilerText", (HideFlags)13, new[] { typeof(GUIText) });
            textGo.transform.position = new Vector3(0.5f, 1, 0);
        }


        _text           = textGo.GetComponent <GUIText>();
        _text.anchor    = TextAnchor.UpperCenter;
        _text.alignment = TextAlignment.Center;
        //_text.font.material.color = Color.white;
        //_text.text = "Remember to save. Last save more than 10 minutes ago.";
        _text.enabled = false;
    }