private GameObject VoidOutCreator(VoidOut voidOut) { var collObj = voidOut.GetComponent <Collider>(); Logger.LogDebug("Found Collider of type " + collObj.GetType().Name); if (!(collObj is BoxCollider) && !(collObj is MeshCollider)) { return(null); } var go = GameObject.CreatePrimitive(PrimitiveType.Cube); if (collObj is BoxCollider) { var boxCol = collObj as BoxCollider; go.transform.position = boxCol.transform.TransformPoint(boxCol.center); go.transform.localScale = boxCol.bounds.size; go.GetComponent <MeshRenderer>().material.color = Color.white; } else { var meshCol = collObj as MeshCollider; go.transform.position = voidOut.transform.position; go.transform.localScale = meshCol.transform.localScale; go.GetComponent <MeshFilter>().mesh = meshCol.sharedMesh; go.GetComponent <MeshRenderer>().material.color = Color.grey; } go.GetComponent <Collider>().enabled = false; return(go); }
public void Awake() { gameEnd = false; stopped = true; textToggle = true; _remastered = DebugManager.remastered; lastCostume = null; var ar = AspectRatio.GetAspectRatio(Screen.width, Screen.height); if (ar.x == 16f && ar.y == 9f) { wideAspect = true; } Logger.LogDebug($"Wide Aspect: {wideAspect}"); DontDestroyOnLoad(gameObject); if (OverlayCanvas == null) { CanvasUtil.CreateFonts(); OverlayCanvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080)); OverlayCanvas.name = "IGTDisplay"; DontDestroyOnLoad(OverlayCanvas); _background = CanvasUtil.CreateImagePanel(OverlayCanvas, new Color32(0x28, 0x28, 0x28, 0x00), wideAspect ? topRightLegacy : topRightHD); _textPanel = CanvasUtil.CreateTMProPanel(_background, string.Empty, 24, TextAnchor.UpperLeft, new CanvasUtil.RectData(new Vector2(-5, -5), new Vector2(0, 0), new Vector2(0, 0), new Vector2(1, 1))); tmProObjRef = _textPanel.GetComponent <TextMeshProUGUI>(); tmProObjRef.alignment = TextAlignmentOptions.TopRight; } }