示例#1
0
 public static void LogMessage(string message, bool showInEditor = false)
 {
     if (showInEditor || Application.isPlaying)
     {
         Debug.Log(Sunshine.FormatMessage(message));
     }
 }
示例#2
0
 private void OnDestroy()
 {
     this.OnDisable();
     if (Sunshine.Instance == this)
     {
         Sunshine.Instance = null;
     }
 }
示例#3
0
 private void RecreateRenderCameras()
 {
     this.DestroyRenderCameras();
     for (int i = 0; i < 4; i++)
     {
         if (!this.SunLightCameras[i])
         {
             this.SunLightCameras[i] = Sunshine.CreateRenderCamera(string.Format("Sunshine Cascade Camera {0}", i));
         }
     }
 }
示例#4
0
 private void SetupSingleton()
 {
     if (Sunshine.Instance == null)
     {
         Sunshine.Instance = this;
     }
     else if (Sunshine.Instance != this && Application.isPlaying)
     {
         Sunshine.LogMessage("Multiple Sunshine Instances detected!", true);
         UnityEngine.Object.Destroy(base.gameObject);
     }
 }
示例#5
0
 public bool Setup()
 {
     this.SetupSingleton();
     if (Application.isPlaying)
     {
         this.Supported = (this.Supported && SystemInfo.supportsRenderTextures);
     }
     else
     {
         this.Supported = SystemInfo.supportsRenderTextures;
     }
     if (!this.Supported)
     {
         this.DestroyLightmap();
         this.DisableShadows();
         return(false);
     }
     this.SetupLightmap();
     if (this.Ready)
     {
         return(true);
     }
     if (!this.Lightmap)
     {
         this.Supported = false;
         Sunshine.LogMessage("Unable to create Lightmap", false);
     }
     if (!this.SunLight && Application.isPlaying)
     {
         this.SunLight = this.FindAppropriateSunLight();
     }
     if (!this.SunLight)
     {
         Sunshine.LogMessage("Sun Light was not configured, and couldn't find appropriate Direction Light...", false);
         if (Application.isPlaying)
         {
             base.enabled = false;
         }
         return(false);
     }
     if (!this.OccluderShader)
     {
         Sunshine.LogMessage("Occluder Shader Missing...", false);
         if (Application.isPlaying)
         {
             base.enabled = false;
         }
         return(false);
     }
     if (!this.OccluderShader.isSupported)
     {
         Sunshine.LogMessage("Occluder Shader Not Supported...", false);
         if (Application.isPlaying)
         {
             base.enabled = false;
         }
         return(false);
     }
     if (!this.PostScatterShader)
     {
         Sunshine.LogMessage("Post Process Scatter Shader Missing...", false);
         if (Application.isPlaying)
         {
             base.enabled = false;
         }
         return(false);
     }
     if (!this.PostBlurShader)
     {
         Sunshine.LogMessage("Post Process Blur Shader Missing...", false);
         if (Application.isPlaying)
         {
             base.enabled = false;
         }
         return(false);
     }
     if (!this.PostDebugShader)
     {
         Sunshine.LogMessage("Post Process Debug Shader Missing...", false);
         if (Application.isPlaying)
         {
             base.enabled = false;
         }
         return(false);
     }
     if (!this.BlankOvercastTexture)
     {
         Sunshine.LogMessage("Blank Overcast Texture Missing...", false);
         if (Application.isPlaying)
         {
             base.enabled = false;
         }
         return(false);
     }
     this.RecreateMaterials();
     this.RecreateRenderCameras();
     this.RecreateTextures();
     this.Ready = true;
     return(true);
 }
示例#6
0
 void OnDestroy()
 {
     OnDisable();
     if(Instance == this)
         Instance = null;
 }
示例#7
0
 void SetupSingleton()
 {
     if(Instance == null)
         Instance = this;
     else if(Instance != this)
     {
         if(Application.isPlaying)
         {
             LogMessage("Multiple Sunshine Instances detected!", true);
             Destroy(gameObject);
         }
     }
 }