Example #1
0
        public static LightLink BuildLink(Transform parent, string name, LightPoint p1, LightPoint p2)
        {
            GameObject pathObj = new GameObject("Line-" + name, typeof(MeshFilter), typeof(MeshRenderer));

            pathObj.transform.SetParent(parent, false);
            MeshRenderer renderer = pathObj.GetComponent <MeshRenderer>();

            renderer.sharedMaterial = SettingsManager.I.activeRoomnet.pathMaterial;
            LightLink lightLink = pathObj.AddComponent <LightLink>();

            lightLink.point1 = p1;
            lightLink.point2 = p2;
            p1.RegisterConnected(lightLink);
            p2.RegisterConnected(lightLink);
            return(lightLink);
        }
Example #2
0
 public void UnregisterConnected(LightLink elem)
 {
     connected.Remove(elem);
 }
Example #3
0
 public void RegisterConnected(LightLink elem)
 {
     connected.Add(elem);
 }
Example #4
0
 public static void DestroyLink(LightLink link)
 {
     link.point1.UnregisterConnected(link);
     link.point2.UnregisterConnected(link);
     Destroy(link.gameObject);
 }