Exemple #1
0
        private void SetCelestialObjectPosition(WeatherMakerCelestialObject obj, Vector3 transformForward)
        {
            switch (obj.OrbitType)
            {
            case WeatherMakerOrbitType.Custom:
                IWeatherMakerCelestialObjectCustomOrbit orbitInterface = obj.OrbitTypeCustomScript as IWeatherMakerCelestialObjectCustomOrbit;
                if (orbitInterface == null)
                {
                    Debug.LogErrorFormat("Unable to use custom orbit for celestial object {0}, field OrbitTypeCustomScript" +
                                         " must be set to a MonoBehavior script implementing IWeatherMakerCelestialObjectCustomOrbit", obj.Transform.gameObject.name);
                }
                else
                {
                    transformForward = orbitInterface.CalculatePosition(obj);
                }
                break;

            default:
                // drop sun faster as it dips below horizon, in summer the sky horizon is visible even at 3am!
                if (transformForward.y > 0.1f)
                {
                    transformForward.y = Mathf.Pow(transformForward.y, 0.8f);
                }
                break;
            }

            obj.Transform.forward = transformForward;
        }
        private void SetCelestialObjectPosition(WeatherMakerCelestialObject obj, Vector3 transformForward)
        {
            switch (obj.OrbitType)
            {
            case WeatherMakerOrbitType.Custom:
                IWeatherMakerCelestialObjectCustomOrbit orbitInterface = obj.OrbitTypeCustomScript as IWeatherMakerCelestialObjectCustomOrbit;
                if (orbitInterface == null)
                {
                    Debug.LogErrorFormat("Unable to use custom orbit for celestial object {0}, field OrbitTypeCustomScript" +
                                         " must be set to a MonoBehavior script implementing IWeatherMakerCelestialObjectCustomOrbit", obj.Transform.gameObject.name);
                }
                else
                {
                    transformForward = orbitInterface.CalculatePosition(obj);
                }
                break;
            }

            obj.Transform.forward = transformForward;
        }