Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
        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);
            }
        }
        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;
            }
        }
Beispiel #4
0
 public void SetReferenceMouseFlight(MouseFlightController controller)
 {
     mouseFlight = controller;
 }