Esempio n. 1
0
    void OnGUI()
    {
        CursorController.DrawReticule();

        /*
         * // If not paused, removes crosshair on pause
         * if (Time.timeScale != 0) {
         *  float screenWidth = (Screen.width / 2) - ((cursor.width * cursorScale) / 2);
         *  float screenHeight = (Screen.height / 2) - ((cursor.height * cursorScale) / 2);
         *  float realX = Event.current.mousePosition.x;
         *  float realY = Event.current.mousePosition.y;
         *
         *
         *  //float hypotenuse = (float)Math.Sqrt(Math.Pow(Math.Abs((Screen.width / 2) - realX), 2) + Math.Pow((Screen.height / 2) - realY, 2));
         *  //if (hypotenuse > mousePosSensitivity) {
         *  //    float angle = Mathf.Atan2(Math.Abs((Screen.height / 2) - realY), Math.Abs((Screen.width / 2) - realX));
         *  //    realX = (Screen.width / 2) + ((Mathf.Cos(angle) * mousePosSensitivity) * (realX > Screen.width / 2 ? 1 : -1));
         *  //    realY = (Screen.height / 2) + ((Mathf.Sin(angle) * mousePosSensitivity) * (realY > Screen.height / 2 ? 1 : -1));
         *  //}
         *
         *  float xPos = realX - ((cursor.width * cursorScale) / 2);
         *  float yPos = realY - ((cursor.height * cursorScale) / 2);
         *
         *  if (cursor != null)
         *      GUI.DrawTexture(new Rect(xPos, yPos, cursor.width * cursorScale, cursor.height * cursorScale), cursor);
         *  else
         *      Debug.Log("No crosshair texture found");
         * }
         */
    }