コード例 #1
0
ファイル: Hud.cs プロジェクト: random-logic/MouseFlight
        private void UpdateGraphics(MouseFlightController controller)
        {
            if (boresight == null)
            {
                Debug.LogError("Hud is trying to access boresight but it is null.");
            }

            if (mousePos == null)
            {
                Debug.LogError("Hud is trying to access mousePos but it is null.");
            }

            if (!mouseFlight.IsMouseAimFrozen)
            {
                boresight.position = playerCam.WorldToScreenPoint(controller.BoresightPos);
                boresight.gameObject.SetActive(boresight.position.z > 1f);

                mousePos.position = playerCam.WorldToScreenPoint(controller.MouseAimPos);
                mousePos.gameObject.SetActive(mousePos.position.z > 1f);
            }
            else
            {
                boresight.anchoredPosition = Vector2.zero;
                mousePos.anchoredPosition  = Vector2.zero;
            }
        }
コード例 #2
0
ファイル: Hud.cs プロジェクト: IJEMIN/MouseFlight
        private void UpdateGraphics(MouseFlightController controller)
        {
            if (boresight != null)
            {
                boresight.position = playerCam.WorldToScreenPoint(controller.BoresightPos);
                boresight.gameObject.SetActive(boresight.position.z > 1f);
            }

            if (mousePos != null)
            {
                mousePos.position = playerCam.WorldToScreenPoint(controller.MouseAimPos);
                mousePos.gameObject.SetActive(mousePos.position.z > 1f);
            }
        }
コード例 #3
0
        private void UpdateGraphics(MouseFlightController controller)
        {
            if (boresight != null)
            {
                Vector2 myPositionOnScreen = playerCam.WorldToScreenPoint(controller.BoresightPos);
                float   scaleFactor        = 1;

                Vector2 finalPosition = new Vector2(myPositionOnScreen.x / scaleFactor, myPositionOnScreen.y / scaleFactor);

                boresight.anchoredPosition = finalPosition;
                //boresight.gameObject.SetActive(boresight.position.z > 1f);
            }

            if (mousePos != null)
            {
                Vector2 myPositionOnScreen = playerCam.WorldToScreenPoint(controller.MouseAimPos);
                float   scaleFactor        = 1;

                Vector2 finalPosition = new Vector2(myPositionOnScreen.x / scaleFactor, myPositionOnScreen.y / scaleFactor);

                mousePos.anchoredPosition = finalPosition;
            }
        }
コード例 #4
0
ファイル: Hud.cs プロジェクト: IJEMIN/MouseFlight
 public void SetReferenceMouseFlight(MouseFlightController controller)
 {
     mouseFlight = controller;
 }