internal override void DrawWindow(int id)
        {
            GUILayout.Label(new GUIContent("Window Contents", "Here is a reallly long tooltip to demonstrate the war and peace model of writing too much text in a tooltip\r\n\r\nIt even includes a couple of carriage returns to make stuff fun"));
            GUILayout.Label(String.Format("Drag Enabled:{0}", DragEnabled.ToString()));
            GUILayout.Label(String.Format("ClampToScreen:{0}", ClampToScreen.ToString()));
            GUILayout.Label(String.Format("Tooltips:{0}", TooltipsEnabled.ToString()));

            if (GUILayout.Button("Toggle Drag"))
            {
                DragEnabled = !DragEnabled;
            }
            if (GUILayout.Button("Toggle Screen Clamping"))
            {
                ClampToScreen = !ClampToScreen;
            }

            if (GUILayout.Button(new GUIContent("Toggle Tooltips", "Can you see my Tooltip?")))
            {
                TooltipsEnabled = !TooltipsEnabled;
            }
            GUILayout.BeginHorizontal();
            GUILayout.Label("Max Tooltip Width");
            TooltipMaxWidth = Convert.ToInt32(GUILayout.TextField(TooltipMaxWidth.ToString()));
            GUILayout.EndHorizontal();
            GUILayout.Label("Width of 0 means no limit");

            GUILayout.Label("Alt+F11 - shows/hides window");
        }
    static void ClampToScreen()
    {
        //Get the prefab
        GameObject obj = Spawn(CLAMP_TO_SCREEN);

        if (obj == null)
        {
            return;
        }

        //Reset the tool
        ClampToScreen tool = obj.GetComponent <ClampToScreen>();

        if (tool == null)
        {
            Debug.LogError(PREFAB_ALTERED_AND_WAS_NOT_ABLE_TO_LOAD + CLAMP_TO_SCREEN);
            DestroyImmediate(obj, true);
            return;
        }

        //Set camera to default
        Camera mainCamera = Camera.main;

        if (mainCamera != null)
        {
            tool.gameCamera = mainCamera;
        }
    }
Beispiel #3
0
 /// <summary>
 /// START
 /// </summary>
 private void Start()
 {
     spriteDivider    = GetComponent <DivideSprite>();
     spawnAnimation   = GetComponent <PlayerInvicibleTimeAnimation>();
     rend             = GetComponent <SpriteRenderer>();
     rigBody          = GetComponent <Rigidbody2D>();
     clamp            = GetComponent <ClampToScreen>();
     movePlayerScript = GetComponent <MovePlayer>();
     Health           = Constants.PlayerHealth;
     Lives            = Constants.PlayerLives;
 }