Esempio n. 1
0
        public void UpdateHudCoordinates(Character c)
        {
            if (!ensureHudCamera())
            {
                return;
            }
            HudData data = getEnemyHud(c);

            if (data == null || data.gui == null || !data.gui.activeSelf)
            {
                return;
            }
            if (data != null)
            {
                data.hudCanvasRoot.transform.position = c.IsPlayer() ? c.GetHeadPoint() : c.GetTopPoint();
                data.hudCanvasRoot.transform.LookAt(_hudCamera.transform);
                data.hudCanvasRoot.transform.rotation *= Quaternion.Euler(0f, 180f, 0f);
                float scale    = 0.06f / data.hudCanvasRoot.GetComponent <Canvas>().GetComponent <RectTransform>().rect.width;
                float distance = Vector3.Distance(_hudCamera.transform.position, data.gui.transform.position);
                data.hudCanvasRoot.GetComponent <Canvas>().GetComponent <RectTransform>().localScale =
                    Vector3.one * scale * distance * VHVRConfig.EnemyHudScale();
            }
        }