private void InitLightSetting() { this.m_worldLight = new GameObject[6]; // Lighting Setting Quaternion[] lightRot = new Quaternion[6]; lightRot[0] = Quaternion.Euler(0f, -90f, 0f); // X+ lightRot[1] = Quaternion.Euler(0f, 90f, 0f); // X- lightRot[2] = Quaternion.Euler(90f, 0f, 0f); // Y+ lightRot[3] = Quaternion.Euler(-90f, 0f, 0f); // Y- lightRot[4] = Quaternion.Euler(180f, 0f, 0f); // Z+ lightRot[5] = Quaternion.Euler(0f, 0f, 0f); // Z- for (int i = 0; i < 6; ++i) { Vector3 lPos = this.m_planeRelativePos[i * 2] * 500f; this.m_worldLight[i] = GameObject.Instantiate(this.m_emptyGameObjectPrefab, lPos, lightRot[i], this.m_worldSetterTransform); WorldAreaEnum ew = (WorldAreaEnum)(i * 2); this.m_worldLight[i].name = ew.ToString() + "_Light"; Light light = this.m_worldLight[i].AddComponent <Light>(); light.type = LightType.Directional; light.intensity = 1f; light.shadows = LightShadows.None; } }
private void InitDebuggingPlanes() { this.m_planeRelativePos = new Vector3[12]; this.m_planeRot = new Quaternion[12]; this.m_prefabPlaneArea = new GameObject[12]; this.m_planeColor = new Color[12]; // plane pos and rot init for debugging const float posMove = 0.52f; const float planeAlphaValue = 0.3f; this.m_planeRelativePos[(uint)WorldAreaEnum.XPLUS] = new Vector3(posMove, 0f, 0f); this.m_planeRot[(uint)WorldAreaEnum.XPLUS + (uint)PlaneDirectionEnum.IN] = Quaternion.Euler(0f, 0f, 90f); this.m_planeColor[(uint)WorldAreaEnum.XPLUS + (uint)PlaneDirectionEnum.IN] = new Color(1f, 0f, 0f, planeAlphaValue); this.m_planeRelativePos[(uint)WorldAreaEnum.XPLUS + 1] = new Vector3(posMove, 0f, 0f); this.m_planeRot[(uint)WorldAreaEnum.XPLUS + (uint)PlaneDirectionEnum.OUT] = Quaternion.Euler(0f, 0f, -90f); this.m_planeColor[(uint)WorldAreaEnum.XPLUS + (uint)PlaneDirectionEnum.OUT] = new Color(1f, 0f, 0f, planeAlphaValue); this.m_planeRelativePos[(uint)WorldAreaEnum.XMINUS] = new Vector3(-posMove, 0f, 0f); this.m_planeRot[(uint)WorldAreaEnum.XMINUS + (uint)PlaneDirectionEnum.IN] = Quaternion.Euler(0f, 0f, -90f); this.m_planeColor[(uint)WorldAreaEnum.XMINUS + (uint)PlaneDirectionEnum.IN] = new Color(1f, 0f, 0f, planeAlphaValue); this.m_planeRelativePos[(uint)WorldAreaEnum.XMINUS + 1] = new Vector3(-posMove, 0f, 0f); this.m_planeRot[(uint)WorldAreaEnum.XMINUS + (uint)PlaneDirectionEnum.OUT] = Quaternion.Euler(0f, 0f, 90f); this.m_planeColor[(uint)WorldAreaEnum.XMINUS + (uint)PlaneDirectionEnum.OUT] = new Color(1f, 0f, 0f, planeAlphaValue); this.m_planeRelativePos[(uint)WorldAreaEnum.YPLUS] = new Vector3(0f, posMove, 0f); this.m_planeRot[(uint)WorldAreaEnum.YPLUS + (uint)PlaneDirectionEnum.IN] = Quaternion.Euler(0f, 0f, 180f); this.m_planeColor[(uint)WorldAreaEnum.YPLUS + (uint)PlaneDirectionEnum.IN] = new Color(0f, 1f, 0f, planeAlphaValue); this.m_planeRelativePos[(uint)WorldAreaEnum.YPLUS + 1] = new Vector3(0f, posMove, 0f); this.m_planeRot[(uint)WorldAreaEnum.YPLUS + (uint)PlaneDirectionEnum.OUT] = Quaternion.Euler(0f, 0f, 0f); this.m_planeColor[(uint)WorldAreaEnum.YPLUS + (uint)PlaneDirectionEnum.OUT] = new Color(0f, 1f, 0f, planeAlphaValue); this.m_planeRelativePos[(uint)WorldAreaEnum.YMINUS] = new Vector3(0f, -posMove, 0f); this.m_planeRot[(uint)WorldAreaEnum.YMINUS + (uint)PlaneDirectionEnum.IN] = Quaternion.Euler(0f, 0f, 0f); this.m_planeColor[(uint)WorldAreaEnum.YMINUS + (uint)PlaneDirectionEnum.IN] = new Color(0f, 1f, 0f, planeAlphaValue); this.m_planeRelativePos[(uint)WorldAreaEnum.YMINUS + 1] = new Vector3(0f, -posMove, 0f); this.m_planeRot[(uint)WorldAreaEnum.YMINUS + (uint)PlaneDirectionEnum.OUT] = Quaternion.Euler(0f, 0f, 180f); this.m_planeColor[(uint)WorldAreaEnum.YMINUS + (uint)PlaneDirectionEnum.OUT] = new Color(0f, 1f, 0f, planeAlphaValue); this.m_planeRelativePos[(uint)WorldAreaEnum.ZPLUS] = new Vector3(0f, 0f, posMove); this.m_planeRot[(uint)WorldAreaEnum.ZPLUS + (uint)PlaneDirectionEnum.IN] = Quaternion.Euler(90f, 0f, 0f); this.m_planeColor[(uint)WorldAreaEnum.ZPLUS + (uint)PlaneDirectionEnum.IN] = new Color(0f, 0f, 1f, planeAlphaValue); this.m_planeRelativePos[(uint)WorldAreaEnum.ZPLUS + 1] = new Vector3(0f, 0f, posMove); this.m_planeRot[(uint)WorldAreaEnum.ZPLUS + (uint)PlaneDirectionEnum.OUT] = Quaternion.Euler(-90f, 0f, 0f); this.m_planeColor[(uint)WorldAreaEnum.ZPLUS + (uint)PlaneDirectionEnum.OUT] = new Color(0f, 0f, 1f, planeAlphaValue); this.m_planeRelativePos[(uint)WorldAreaEnum.ZMINUS] = new Vector3(0f, 0, -posMove); this.m_planeRot[(uint)WorldAreaEnum.ZMINUS + (uint)PlaneDirectionEnum.IN] = Quaternion.Euler(-90f, 0f, 0f); this.m_planeColor[(uint)WorldAreaEnum.ZMINUS + (uint)PlaneDirectionEnum.IN] = new Color(0f, 0f, 1f, planeAlphaValue); this.m_planeRelativePos[(uint)WorldAreaEnum.ZMINUS + 1] = new Vector3(0f, 0f, -posMove); this.m_planeRot[(uint)WorldAreaEnum.ZMINUS + (uint)PlaneDirectionEnum.OUT] = Quaternion.Euler(90f, 0f, 0f); this.m_planeColor[(uint)WorldAreaEnum.ZMINUS + (uint)PlaneDirectionEnum.OUT] = new Color(0f, 0f, 1f, planeAlphaValue); Material planeMat = Resources.Load("Prefab/PlaneTransparency") as Material; GameObject prefab = Resources.Load("Prefab/pAreaPlane") as GameObject; GameObject planeParent = GameObject.Instantiate(this.m_emptyGameObjectPrefab, this.m_cubeWorldTransform); planeParent.name = "PlaneParent"; Transform planeParentTransform = planeParent.transform; int worldBarrierLayerIndex = LayerMask.NameToLayer("CGWorldBarrier"); for (int i = 0; i < 12; ++i) { this.m_prefabPlaneArea[i] = GameObject.Instantiate(prefab, planeParentTransform); this.m_prefabPlaneArea[i].GetComponent <Renderer>().enabled = this.bPlaneDebuggingDisplayEnable; this.m_prefabPlaneArea[i].layer = worldBarrierLayerIndex; // Basic Setting WorldAreaEnum ew = ((i % 2) == 0 ? (WorldAreaEnum)i : (WorldAreaEnum)(i - 1)); PlaneDirectionEnum ep = (PlaneDirectionEnum)(i % 2); this.m_prefabPlaneArea[i].name = ew.ToString() + '_' + ep.ToString(); this.m_prefabPlaneArea[i].transform.localPosition = this.m_planeRelativePos[i]; this.m_prefabPlaneArea[i].transform.localRotation = this.m_planeRot[i]; // Material Setting MeshRenderer mr = this.m_prefabPlaneArea[i].GetComponent <MeshRenderer>(); mr.material = Material.Instantiate(planeMat); mr.material.SetColor("_Color", this.m_planeColor[i]); // Plane Collider Setting for preventing from a character moving to another cube face Rigidbody rb = this.m_prefabPlaneArea[i].AddComponent <Rigidbody>(); rb.mass = 100f; rb.isKinematic = true; rb.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative; } planeParent.SetActive(true); }