Ejemplo n.º 1
0
    protected void Update()
    {
        Vector2       vector2   = new Vector2(Mathf.Cos(0.0174532924f * (this.WindDegrees + 15f)), Mathf.Sin(0.0174532924f * (this.WindDegrees + 15f)));
        Vector2       vector21  = new Vector2(Mathf.Cos(0.0174532924f * (this.WindDegrees - 15f)), Mathf.Sin(0.0174532924f * (this.WindDegrees - 15f)));
        Vector4       windSpeed = this.WindSpeed / 100f * new Vector4(vector2.x, vector2.y, vector21.x, vector21.y);
        TOD_Animation cloudUV   = this;

        cloudUV.CloudUV = cloudUV.CloudUV + (Time.deltaTime * windSpeed);
        Vector4 vector4  = this.CloudUV;
        float   scale1   = vector4.x % this.sky.Clouds.Scale1.x;
        Vector4 cloudUV1 = this.CloudUV;
        float   single   = cloudUV1.y % this.sky.Clouds.Scale1.y;
        Vector4 vector41 = this.CloudUV;
        float   scale2   = vector41.z % this.sky.Clouds.Scale2.x;
        Vector4 cloudUV2 = this.CloudUV;

        this.CloudUV = new Vector4(scale1, single, scale2, cloudUV2.w % this.sky.Clouds.Scale2.y);
    }
Ejemplo n.º 2
0
 protected void OnEnable()
 {
     this.DomeTransform = base.transform;
     if (Camera.main == null)
     {
         Debug.LogWarning("Main camera does not exist or is not tagged 'MainCamera'.");
     }
     else
     {
         this.CameraTransform = Camera.main.transform;
     }
     this.Sky       = base.GetComponent <TOD_Sky>();
     this.Animation = base.GetComponent <TOD_Animation>();
     this.Time      = base.GetComponent <TOD_Time>();
     this.Weather   = base.GetComponent <TOD_Weather>();
     this.Resources = base.GetComponent <TOD_Resources>();
     if (!this.Space)
     {
         Debug.LogError("Space reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.SpaceRenderer   = this.Space.renderer;
     this.SpaceShader     = this.SpaceRenderer.sharedMaterial;
     this.SpaceMeshFilter = this.Space.GetComponent <MeshFilter>();
     if (!this.Atmosphere)
     {
         Debug.LogError("Atmosphere reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.AtmosphereRenderer   = this.Atmosphere.renderer;
     this.AtmosphereShader     = this.AtmosphereRenderer.sharedMaterial;
     this.AtmosphereMeshFilter = this.Atmosphere.GetComponent <MeshFilter>();
     if (!this.Clear)
     {
         Debug.LogError("Clear reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.ClearRenderer   = this.Clear.renderer;
     this.ClearShader     = this.ClearRenderer.sharedMaterial;
     this.ClearMeshFilter = this.Clear.GetComponent <MeshFilter>();
     if (!this.Clouds)
     {
         Debug.LogError("Clouds reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.CloudRenderer   = this.Clouds.renderer;
     this.CloudShader     = this.CloudRenderer.sharedMaterial;
     this.CloudMeshFilter = this.Clouds.GetComponent <MeshFilter>();
     if (!this.Projector)
     {
         Debug.LogError("Projector reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.ShadowProjector = this.Projector.GetComponent <UnityEngine.Projector>();
     this.ShadowShader    = this.ShadowProjector.material;
     if (!this.Light)
     {
         Debug.LogError("Light reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.LightTransform = this.Light.transform;
     this.LightSource    = this.Light.light;
     if (!this.Sun)
     {
         Debug.LogError("Sun reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.SunTransform  = this.Sun.transform;
     this.SunRenderer   = this.Sun.renderer;
     this.SunShader     = this.SunRenderer.sharedMaterial;
     this.SunMeshFilter = this.Sun.GetComponent <MeshFilter>();
     if (!this.Moon)
     {
         Debug.LogError("Moon reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.MoonTransform  = this.Moon.transform;
     this.MoonRenderer   = this.Moon.renderer;
     this.MoonShader     = this.MoonRenderer.sharedMaterial;
     this.MoonMeshFilter = this.Moon.GetComponent <MeshFilter>();
 }
Ejemplo n.º 3
0
    protected void OnEnable()
    {
        DomeTransform   = transform;
        CameraTransform = Camera.main != null ? Camera.main.transform : DomeTransform;

        Sky       = GetComponent <TOD_Sky>();
        Animation = GetComponent <TOD_Animation>();
        Time      = GetComponent <TOD_Time>();
        Weather   = GetComponent <TOD_Weather>();
        Resources = GetComponent <TOD_Resources>();

        if (Space)
        {
            SpaceRenderer   = Space.renderer;
            SpaceShader     = SpaceRenderer.sharedMaterial;
            SpaceMeshFilter = Space.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Space reference not set. Disabling script.");
            this.enabled = false;
            return;
        }

        if (Atmosphere)
        {
            AtmosphereRenderer   = Atmosphere.renderer;
            AtmosphereShader     = AtmosphereRenderer.sharedMaterial;
            AtmosphereMeshFilter = Atmosphere.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Atmosphere reference not set. Disabling script.");
            this.enabled = false;
            return;
        }

        if (Clouds)
        {
            CloudRenderer   = Clouds.renderer;
            CloudShader     = CloudRenderer.sharedMaterial;
            CloudMeshFilter = Clouds.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Clouds reference not set. Disabling script.");
            this.enabled = false;
            return;
        }

        if (Projector)
        {
            ShadowProjector = Projector.GetComponent <Projector>();
            ShadowShader    = ShadowProjector.material;
        }
        else
        {
            Debug.LogError("Projector reference not set. Disabling script.");
            this.enabled = false;
            return;
        }

        if (Light)
        {
            LightTransform = Light.transform;
            LightSource    = Light.light;
        }
        else
        {
            Debug.LogError("Light reference not set. Disabling script.");
            this.enabled = false;
            return;
        }

        if (Sun)
        {
            SunTransform  = Sun.transform;
            SunRenderer   = Sun.renderer;
            SunShader     = SunRenderer.sharedMaterial;
            SunMeshFilter = Sun.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Sun reference not set. Disabling script.");
            this.enabled = false;
            return;
        }

        if (Moon)
        {
            MoonTransform  = Moon.transform;
            MoonRenderer   = Moon.renderer;
            MoonShader     = MoonRenderer.sharedMaterial;
            MoonMeshFilter = Moon.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Moon reference not set. Disabling script.");
            this.enabled = false;
            return;
        }
    }
Ejemplo n.º 4
0
    /// Initializes all component references
    public void Initialize()
    {
        DomeTransform = GetComponent <Transform>();

        Sky       = GetComponent <TOD_Sky>();
        Animation = GetComponent <TOD_Animation>();
        Time      = GetComponent <TOD_Time>();
        Weather   = GetComponent <TOD_Weather>();
        Resources = GetComponent <TOD_Resources>();

        if (Space)
        {
            SpaceTransform  = Space.GetComponent <Transform>();
            SpaceRenderer   = Space.GetComponent <Renderer>();
            SpaceMaterial   = SpaceRenderer.sharedMaterial;
            SpaceMeshFilter = Space.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Space reference not set.");
        }

        if (Atmosphere)
        {
            AtmosphereRenderer   = Atmosphere.GetComponent <Renderer>();
            AtmosphereMaterial   = AtmosphereRenderer.sharedMaterial;
            AtmosphereMeshFilter = Atmosphere.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Atmosphere reference not set.");
        }

        if (Clear)
        {
            ClearRenderer   = Clear.GetComponent <Renderer>();
            ClearMaterial   = ClearRenderer.sharedMaterial;
            ClearMeshFilter = Clear.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Clear reference not set.");
        }

        if (Clouds)
        {
            CloudRenderer   = Clouds.GetComponent <Renderer>();
            CloudMaterial   = CloudRenderer.sharedMaterial;
            CloudMeshFilter = Clouds.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Clouds reference not set.");
        }

        if (Projector)
        {
            ShadowProjector = Projector.GetComponent <Projector>();
            ShadowMaterial  = ShadowProjector.material;
        }
        else
        {
            Debug.LogError("Projector reference not set.");
        }

        if (Light)
        {
            LightTransform = Light.GetComponent <Transform>();
            LightSource    = Light.GetComponent <Light>();
        }
        else
        {
            Debug.LogError("Light reference not set.");
        }

        if (Sun)
        {
            SunTransform  = Sun.GetComponent <Transform>();
            SunRenderer   = Sun.GetComponent <Renderer>();
            SunMaterial   = SunRenderer.sharedMaterial;
            SunMeshFilter = Sun.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Sun reference not set.");
        }

        if (Moon)
        {
            MoonTransform  = Moon.GetComponent <Transform>();
            MoonRenderer   = Moon.GetComponent <Renderer>();
            MoonMaterial   = MoonRenderer.sharedMaterial;
            MoonMeshFilter = Moon.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Moon reference not set.");
        }
    }
Ejemplo n.º 5
0
    /// Initializes all component references.
    public void Initialize()
    {
        DomeTransform = GetComponent<Transform>();

        Sky       = GetComponent<TOD_Sky>();
        Animation = GetComponent<TOD_Animation>();
        Time      = GetComponent<TOD_Time>();
        Weather   = GetComponent<TOD_Weather>();

        if (Space)
        {
            SpaceTransform  = Space.GetComponent<Transform>();
            SpaceRenderer   = Space.GetComponent<Renderer>();
            SpaceMaterial   = SpaceRenderer.sharedMaterial;
            SpaceMeshFilter = Space.GetComponent<MeshFilter>();
        }
        else
        {
            Debug.LogError("Space reference not set.");
        }

        if (Atmosphere)
        {
            AtmosphereRenderer   = Atmosphere.GetComponent<Renderer>();
            AtmosphereMaterial   = AtmosphereRenderer.sharedMaterial;
            AtmosphereMeshFilter = Atmosphere.GetComponent<MeshFilter>();
        }
        else
        {
            Debug.LogError("Atmosphere reference not set.");
        }

        if (Clear)
        {
            ClearRenderer   = Clear.GetComponent<Renderer>();
            ClearMaterial   = ClearRenderer.sharedMaterial;
            ClearMeshFilter = Clear.GetComponent<MeshFilter>();
        }
        else
        {
            Debug.LogError("Clear reference not set.");
        }

        if (Clouds)
        {
            CloudRenderer   = Clouds.GetComponent<Renderer>();
            CloudMaterial   = CloudRenderer.sharedMaterial;
            CloudMeshFilter = Clouds.GetComponent<MeshFilter>();
        }
        else
        {
            Debug.LogError("Clouds reference not set.");
        }

        if (Projector)
        {
            ShadowProjector = Projector.GetComponent<Projector>();
            ShadowMaterial  = ShadowProjector.material;
        }
        else
        {
            Debug.LogError("Projector reference not set.");
        }

        if (Light)
        {
            LightTransform = Light.GetComponent<Transform>();
            LightSource    = Light.GetComponent<Light>();
        }
        else
        {
            Debug.LogError("Light reference not set.");
        }

        if (Sun)
        {
            SunTransform  = Sun.GetComponent<Transform>();
            SunRenderer   = Sun.GetComponent<Renderer>();
            SunMaterial   = SunRenderer.sharedMaterial;
            SunMeshFilter = Sun.GetComponent<MeshFilter>();
        }
        else
        {
            Debug.LogError("Sun reference not set.");
        }

        if (Moon)
        {
            MoonTransform  = Moon.GetComponent<Transform>();
            MoonRenderer   = Moon.GetComponent<Renderer>();
            MoonMaterial   = MoonRenderer.sharedMaterial;
            MoonMeshFilter = Moon.GetComponent<MeshFilter>();
        }
        else
        {
            Debug.LogError("Moon reference not set.");
        }

        if (Billboards)
        {
            // Intentionally left empty
        }
        else
        {
            Debug.LogError("Billboards reference not set.");
        }
    }
    protected void OnEnable()
    {
        DomeTransform   = transform;
        CameraTransform = Camera.main != null ? Camera.main.transform : DomeTransform;

        Sky       = GetComponent<TOD_Sky>();
        Animation = GetComponent<TOD_Animation>();
        Time      = GetComponent<TOD_Time>();
        Weather   = GetComponent<TOD_Weather>();
        Resources = GetComponent<TOD_Resources>();

        if (Space)
        {
            SpaceRenderer   = Space.renderer;
            SpaceShader     = SpaceRenderer.sharedMaterial;
            SpaceMeshFilter = Space.GetComponent<MeshFilter>();
        }
        else
        {
            Debug.LogError("Space reference not set. Disabling script.");
            this.enabled = false;
            return;
        }

        if (Atmosphere)
        {
            AtmosphereRenderer   = Atmosphere.renderer;
            AtmosphereShader     = AtmosphereRenderer.sharedMaterial;
            AtmosphereMeshFilter = Atmosphere.GetComponent<MeshFilter>();
        }
        else
        {
            Debug.LogError("Atmosphere reference not set. Disabling script.");
            this.enabled = false;
            return;
        }

        if (Clouds)
        {
            CloudRenderer   = Clouds.renderer;
            CloudShader     = CloudRenderer.sharedMaterial;
            CloudMeshFilter = Clouds.GetComponent<MeshFilter>();
        }
        else
        {
            Debug.LogError("Clouds reference not set. Disabling script.");
            this.enabled = false;
            return;
        }

        if (Projector)
        {
            ShadowProjector = Projector.GetComponent<Projector>();
            ShadowShader    = ShadowProjector.material;
        }
        else
        {
            Debug.LogError("Projector reference not set. Disabling script.");
            this.enabled = false;
            return;
        }

        if (Light)
        {
            LightTransform = Light.transform;
            LightSource    = Light.light;
        }
        else
        {
            Debug.LogError("Light reference not set. Disabling script.");
            this.enabled = false;
            return;
        }

        if (Sun)
        {
            SunTransform  = Sun.transform;
            SunRenderer   = Sun.renderer;
            SunShader     = SunRenderer.sharedMaterial;
            SunMeshFilter = Sun.GetComponent<MeshFilter>();
        }
        else
        {
            Debug.LogError("Sun reference not set. Disabling script.");
            this.enabled = false;
            return;
        }

        if (Moon)
        {
            MoonTransform  = Moon.transform;
            MoonRenderer   = Moon.renderer;
            MoonShader     = MoonRenderer.sharedMaterial;
            MoonMeshFilter = Moon.GetComponent<MeshFilter>();
        }
        else
        {
            Debug.LogError("Moon reference not set. Disabling script.");
            this.enabled = false;
            return;
        }
    }
Ejemplo n.º 7
0
    protected void OnEnable()
    {
        DomeTransform = transform;

        if (Camera.main != null)
        {
            CameraTransform = Camera.main.transform;
        }
        else
        {
            Debug.LogWarning("Main camera does not exist or is not tagged 'MainCamera'.");
        }

        Sky       = GetComponent <TOD_Sky>();
        Animation = GetComponent <TOD_Animation>();
        Time      = GetComponent <TOD_Time>();
        Weather   = GetComponent <TOD_Weather>();
        Resources = GetComponent <TOD_Resources>();

        if (Space)
        {
            SpaceRenderer   = Space.GetComponent <Renderer>();
            SpaceShader     = SpaceRenderer.sharedMaterial;
            SpaceMeshFilter = Space.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Space reference not set. Disabling TOD_Sky script.");
            Sky.enabled = false;
            return;
        }

        if (Atmosphere)
        {
            AtmosphereRenderer   = Atmosphere.GetComponent <Renderer>();
            AtmosphereShader     = AtmosphereRenderer.sharedMaterial;
            AtmosphereMeshFilter = Atmosphere.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Atmosphere reference not set. Disabling TOD_Sky script.");
            Sky.enabled = false;
            return;
        }

        if (Clear)
        {
            ClearRenderer   = Clear.GetComponent <Renderer>();
            ClearShader     = ClearRenderer.sharedMaterial;
            ClearMeshFilter = Clear.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Clear reference not set. Disabling TOD_Sky script.");
            Sky.enabled = false;
            return;
        }

        if (Clouds)
        {
            CloudRenderer   = Clouds.GetComponent <Renderer>();
            CloudShader     = CloudRenderer.sharedMaterial;
            CloudMeshFilter = Clouds.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Clouds reference not set. Disabling TOD_Sky script.");
            Sky.enabled = false;
            return;
        }

        if (Projector)
        {
            ShadowProjector = Projector.GetComponent <Projector>();
            ShadowShader    = ShadowProjector.material;
        }
        else
        {
            Debug.LogError("Projector reference not set. Disabling TOD_Sky script.");
            Sky.enabled = false;
            return;
        }

        if (Light)
        {
            //LightTransform = gameObject.FindOrCreateChild ("LightTransform");//Light.transform;
            LightSource = Light.GetComponent <Light>();
        }
        else
        {
            Debug.LogError("Light reference not set. Disabling TOD_Sky script.");
            Sky.enabled = false;
            return;
        }

        if (Sun)
        {
            SunTransform  = Sun.transform;
            SunRenderer   = Sun.GetComponent <Renderer>();
            SunShader     = SunRenderer.sharedMaterial;
            SunMeshFilter = Sun.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Sun reference not set. Disabling TOD_Sky script.");
            Sky.enabled = false;
            return;
        }

        if (Moon)
        {
            MoonTransform  = Moon.transform;
            MoonRenderer   = Moon.GetComponent <Renderer>();
            MoonShader     = MoonRenderer.sharedMaterial;
            MoonMeshFilter = Moon.GetComponent <MeshFilter>();
        }
        else
        {
            Debug.LogError("Moon reference not set. Disabling TOD_Sky script.");
            Sky.enabled = false;
            return;
        }

        if (Application.isPlaying)
        {
            DontDestroyOnLoad(transform);
            DontDestroyOnLoad(LightTransform);
            DontDestroyOnLoad(LightSource);
        }
    }
Ejemplo n.º 8
0
 protected void OnEnable()
 {
     this.DomeTransform = base.transform;
     if (Camera.main == null)
     {
         Debug.LogWarning("Main camera does not exist or is not tagged 'MainCamera'.");
     }
     else
     {
         this.CameraTransform = Camera.main.transform;
     }
     this.Sky = base.GetComponent<TOD_Sky>();
     this.Animation = base.GetComponent<TOD_Animation>();
     this.Time = base.GetComponent<TOD_Time>();
     this.Weather = base.GetComponent<TOD_Weather>();
     this.Resources = base.GetComponent<TOD_Resources>();
     if (!this.Space)
     {
         Debug.LogError("Space reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.SpaceRenderer = this.Space.renderer;
     this.SpaceShader = this.SpaceRenderer.sharedMaterial;
     this.SpaceMeshFilter = this.Space.GetComponent<MeshFilter>();
     if (!this.Atmosphere)
     {
         Debug.LogError("Atmosphere reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.AtmosphereRenderer = this.Atmosphere.renderer;
     this.AtmosphereShader = this.AtmosphereRenderer.sharedMaterial;
     this.AtmosphereMeshFilter = this.Atmosphere.GetComponent<MeshFilter>();
     if (!this.Clear)
     {
         Debug.LogError("Clear reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.ClearRenderer = this.Clear.renderer;
     this.ClearShader = this.ClearRenderer.sharedMaterial;
     this.ClearMeshFilter = this.Clear.GetComponent<MeshFilter>();
     if (!this.Clouds)
     {
         Debug.LogError("Clouds reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.CloudRenderer = this.Clouds.renderer;
     this.CloudShader = this.CloudRenderer.sharedMaterial;
     this.CloudMeshFilter = this.Clouds.GetComponent<MeshFilter>();
     if (!this.Projector)
     {
         Debug.LogError("Projector reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.ShadowProjector = this.Projector.GetComponent<UnityEngine.Projector>();
     this.ShadowShader = this.ShadowProjector.material;
     if (!this.Light)
     {
         Debug.LogError("Light reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.LightTransform = this.Light.transform;
     this.LightSource = this.Light.light;
     if (!this.Sun)
     {
         Debug.LogError("Sun reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.SunTransform = this.Sun.transform;
     this.SunRenderer = this.Sun.renderer;
     this.SunShader = this.SunRenderer.sharedMaterial;
     this.SunMeshFilter = this.Sun.GetComponent<MeshFilter>();
     if (!this.Moon)
     {
         Debug.LogError("Moon reference not set. Disabling TOD_Sky script.");
         this.Sky.enabled = false;
         return;
     }
     this.MoonTransform = this.Moon.transform;
     this.MoonRenderer = this.Moon.renderer;
     this.MoonShader = this.MoonRenderer.sharedMaterial;
     this.MoonMeshFilter = this.Moon.GetComponent<MeshFilter>();
 }