コード例 #1
0
        private void CreateSun()
        {
            GameObject sunGo = sphereGenerator.CreatePlanet(sunMaterial, Constants.k_SunSize);

            sunGo.name = Constants.k_SunName;

            // add sun light
            GameObject lightGameObject = new GameObject("Sun Light");
            Light      lightComp       = lightGameObject.AddComponent <Light>();

            lightComp.color     = Constants.k_WhiteColor;
            lightComp.range     = Constants.k_SunLightRange;
            lightComp.intensity = Constants.k_SunLightIntencity;
            lightGameObject.transform.parent   = sunGo.transform;
            lightGameObject.transform.position = Vector3.zero;

            Sun sun = sunGo.AddComponent <Sun>();

            this.sun = sun;
        }