Пример #1
0
        public static void OnDisplayChanged(Ex.Typed comp, ExEntityLink link)
        {
            TypedHook hook = link.Require <TypedHook>();

            if (hook.type == null || hook.type != comp.type)
            {
                link.gameObject.name = $"{comp.type}:{link.id}";
                hook.type            = comp.type;
            }
        }
Пример #2
0
        public static void OnNameplateChanged(Nameplate nameplate, ExEntityLink link)
        {
            NameplateHook hook = link.Require <NameplateHook>();

            if (hook.name3d == null)
            {
                var prefab = Resources.Load <TextMeshPro>("Nameplate");
                hook.name3d = Instantiate(prefab, hook.transform.position, hook.transform.rotation);
                hook.name3d.transform.SetParent(hook.transform);
            }

            if (hook.nname != nameplate.name)
            {
                hook.nname       = nameplate.name;
                hook.name3d.text = hook.nname;
            }
        }
Пример #3
0
        public static void OnDisplayChanged(Ex.Display display, ExEntityLink link)
        {
            DisplayHook hook = link.Require <DisplayHook>();

            if (hook.child == null || hook.prefab != display.prefab)
            {
                if (hook.child != null)
                {
                    GameObject.Destroy(hook.child.gameObject);
                }

                hook.prefab = display.prefab;
                Transform prefab = SafeLoad <Transform>(display.prefab, "Models/Error");
                Transform copy   = GameObject.Instantiate(prefab, link.transform);
                hook.child = copy;
            }

            hook.child.localPosition = display.position;
            hook.child.localRotation = Quaternion.Euler(display.rotation);
        }