Пример #1
0
    private void UpdateCrossHairPosition()
    {
        if (!m_IsIn6DofMode)
            return;
        
        GameplayProxy sceneProxy = Facade.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;
        SpacecraftEntity main = sceneProxy.GetEntityById<SpacecraftEntity>(sceneProxy.GetMainPlayerUID());

        Vector3 offset = main.GetMouseOffset();
        float x = Screen.width / 2 + offset.x;
        float y = Screen.height / 2 + offset.y;

        Vector2 point;
        if (RectTransformUtility.ScreenPointToLocalPointInRectangle(m_Root.parent.GetComponent<RectTransform>(), new Vector2(x, y), m_Camera, out point))
        {
            m_Root.anchoredPosition = point;
        }
    }