//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public void Awake() { RandomUtil.Init(RandomSeed); //// var lightObj = new GameObject("Light"); lightObj.transform.SetParent(gameObject.transform, false); lightObj.transform.localPosition = new Vector3(0, 1.5f, 0); vLight = lightObj.AddComponent <Light>(); vLight.type = LightType.Point; vLight.range = LightRange; vLight.intensity = 1; //// var pixObj = new GameObject("PixelLabel"); pixObj.transform.SetParent(gameObject.transform, false); UiLabel pix = pixObj.AddComponent <UiLabel>(); pixObj.SetActive(false); vPixels = new DemoTextPixels(pix); //// /*var boxesObj = new GameObject("Boxes"); * boxesObj.transform.SetParent(gameObject.transform, false); * boxesObj.transform.localPosition = new Vector3(0, 0, 3.5f); * boxesObj.transform.localRotation = * Quaternion.FromToRotation(Vector3.up, new Vector3(0, 1, -1.5f).normalized); * boxesObj.transform.localScale = Vector3.one*0.2f; * * vBoxes = boxesObj.AddComponent<DemoBoxes>();*/ for (int i = 0; i < 6; ++i) { var lettHoldObj = new GameObject("LetterHold" + i); lettHoldObj.transform.SetParent(gameObject.transform, false); var lettObj = new GameObject("Letter"); lettObj.transform.SetParent(lettHoldObj.transform, false); lettObj.transform.localScale = Vector3.one * 0.3f; var lett = lettObj.AddComponent <DemoLetter>(); lett.RandomAxis = Random.onUnitSphere; vLetterCache.Add(lett); lettObj.SetActive(false); } //// for (int i = 0; i < 40; ++i) { var ringObj = new GameObject("Ring" + i); ringObj.transform.SetParent(gameObject.transform, false); ringObj.transform.localPosition = Random.onUnitSphere * 2; ringObj.transform.localRotation = Random.rotation; DemoRing ring = ringObj.AddComponent <DemoRing>(); ring.Radius = RandomUtil.Float(LightRange * 0.4f) + 3; } //// GameObject ovrObj = GameObject.Find("LeapOVRPlayerController"); if (ovrObj != null) { OVRPlayerController ovrPlayer = ovrObj.GetComponent <OVRPlayerController>(); ovrPlayer.SetSkipMouseRotation(true); } }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public void Awake() { RandomUtil.Init(RandomSeed); //// var lightObj = new GameObject("Light"); lightObj.transform.SetParent(gameObject.transform, false); lightObj.transform.localPosition = new Vector3(0, 1.5f, 0); vLight = lightObj.AddComponent<Light>(); vLight.type = LightType.Point; vLight.range = LightRange; vLight.intensity = 1; //// var pixObj = new GameObject("PixelLabel"); pixObj.transform.SetParent(gameObject.transform, false); UiLabel pix = pixObj.AddComponent<UiLabel>(); pixObj.SetActive(false); vPixels = new DemoTextPixels(pix); //// /*var boxesObj = new GameObject("Boxes"); boxesObj.transform.SetParent(gameObject.transform, false); boxesObj.transform.localPosition = new Vector3(0, 0, 3.5f); boxesObj.transform.localRotation = Quaternion.FromToRotation(Vector3.up, new Vector3(0, 1, -1.5f).normalized); boxesObj.transform.localScale = Vector3.one*0.2f; vBoxes = boxesObj.AddComponent<DemoBoxes>();*/ for ( int i = 0 ; i < 6 ; ++i ) { var lettHoldObj = new GameObject("LetterHold"+i); lettHoldObj.transform.SetParent(gameObject.transform, false); var lettObj = new GameObject("Letter"); lettObj.transform.SetParent(lettHoldObj.transform, false); lettObj.transform.localScale = Vector3.one*0.3f; var lett = lettObj.AddComponent<DemoLetter>(); lett.RandomAxis = Random.onUnitSphere; vLetterCache.Add(lett); lettObj.SetActive(false); } //// for ( int i = 0 ; i < 40 ; ++i ) { var ringObj = new GameObject("Ring"+i); ringObj.transform.SetParent(gameObject.transform, false); ringObj.transform.localPosition = Random.onUnitSphere*2; ringObj.transform.localRotation = Random.rotation; DemoRing ring = ringObj.AddComponent<DemoRing>(); ring.Radius = RandomUtil.Float(LightRange*0.4f)+3; } //// GameObject ovrObj = GameObject.Find("LeapOVRPlayerController"); if ( ovrObj != null ) { OVRPlayerController ovrPlayer = ovrObj.GetComponent<OVRPlayerController>(); ovrPlayer.SetSkipMouseRotation(true); } }