Beispiel #1
0
 void AddShadowTrigger()
 {
     if (GlobalProjectorManager.Exists())
     {
         GlobalProjectorManager.Get().AddShadowTrigger(this);
     }
 }
Beispiel #2
0
 void RemoveShadowTrigger()
 {
     if (GlobalProjectorManager.Exists())
     {
         GlobalProjectorManager.Get().RemoveShadowTrigger(this);
     }
 }
Beispiel #3
0
 // Token: 0x060001F6 RID: 502 RVA: 0x0001B5D0 File Offset: 0x000197D0
 private void RemoveReceiver()
 {
     if (GlobalProjectorManager.Exists() && this._meshFilter != null)
     {
         GlobalProjectorManager.Get().RemoveReceiver(this);
     }
 }
Beispiel #4
0
 // Token: 0x060001F5 RID: 501 RVA: 0x0001B5B0 File Offset: 0x000197B0
 private void AddReceiver()
 {
     if (this._meshFilter != null)
     {
         GlobalProjectorManager.Get().AddReceiver(this);
     }
 }
Beispiel #5
0
 void OnGUI()
 {
     if (GUI.Button(new Rect(Screen.width - 140, 50, 130, 40), "Toggle Shadows"))
     {
         GlobalProjectorManager.Get().ShadowsOn = !GlobalProjectorManager.Get().ShadowsOn;
     }
 }
Beispiel #6
0
 // Token: 0x060001DF RID: 479 RVA: 0x0001AFF0 File Offset: 0x000191F0
 private void OnDestroy()
 {
     if (GlobalProjectorManager.Exists())
     {
         GlobalProjectorManager.Get().RemoveProjector(this);
     }
 }
 // This is just for sample scene, when creating your own scene & terrain this will be done automatically
 void Awake()
 {
 #if UNITY_5_0 || UNITY_5_1
     duplicateTerrain.materialType = Terrain.MaterialType.Custom;
 #endif
     duplicateTerrain.materialTemplate = terrainMat;
     duplicateTerrain.materialTemplate.SetTexture("_ShadowTex", GlobalProjectorManager.Get().GetShadowTexture());
 }
Beispiel #8
0
 // This is just for sample scene, when creating your own scene & terrain this will be done automatically
 void Awake()
 {
 #if UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_4 || UNITY_5_5 || UNITY_5_6 || UNITY_5_7 || UNITY_2017 || UNITY_2018 || UNITY_2019 || UNITY_2020
     duplicateTerrain.materialType = Terrain.MaterialType.Custom;
 #endif
     duplicateTerrain.materialTemplate = terrainMat;
     duplicateTerrain.materialTemplate.SetTexture("_ShadowTex", GlobalProjectorManager.Get().GetShadowTexture());
 }
 public static GlobalProjectorManager Get()
 {
     if (_Instance == null)
     {
         _Instance = new GameObject("_FSPGlobalProjectorManager").AddComponent <GlobalProjectorManager>();
         _Instance.Initialize();
     }
     return(_Instance);
 }
Beispiel #10
0
        public static Mesh CreatePlane(Vector3 up, Vector3 right, Rect uvRect, Color color, ShadowProjector parent)
        {
            Mesh planeMesh = new Mesh();

            bool    shouldFlipX = (GlobalProjectorManager.Exists() ? GlobalProjectorManager.GlobalFlipX : parent.GlobalFlipX);
            Vector2 flipX       = new Vector2(uvRect.width, -uvRect.width);

            bool    shouldFlipY = (GlobalProjectorManager.Exists() ? GlobalProjectorManager.GlobalFlipY : parent.GlobalFlipY);
            Vector2 flipY       = new Vector2(-uvRect.height, uvRect.height);

            Vector3[] vertices = new Vector3[] {
                (up * 0.5f - right * 0.5f),
                (up * 0.5f + right * 0.5f),
                (-up * 0.5f - right * 0.5f),
                (-up * 0.5f + right * 0.5f)
            };

            Vector2[] uvs = new Vector2[] {
                new Vector2(uvRect.x, uvRect.y + uvRect.height),
                new Vector2(uvRect.x + uvRect.width, uvRect.y + uvRect.height),
                new Vector2(uvRect.x, uvRect.y),
                new Vector2(uvRect.x + uvRect.width, uvRect.y),
            };

            Color[] colors = new Color[] {
                color,
                color,
                color,
                color
            };

            int[] indices = new int[] { 0, 1, 3, 0, 3, 2 };

            if (shouldFlipX)
            {
                uvs[0].x += flipX[0];
                uvs[1].x += flipX[1];
                uvs[2].x += flipX[0];
                uvs[3].x += flipX[1];
            }

            if (shouldFlipY)
            {
                uvs[0].y += flipY[0];
                uvs[1].y += flipY[0];
                uvs[2].y += flipY[1];
                uvs[3].y += flipY[1];
            }

            planeMesh.vertices = vertices;
            planeMesh.uv       = uvs;
            planeMesh.colors   = colors;
            planeMesh.SetTriangles(indices, 0);

            return(planeMesh);
        }
 void AddReceiver()
 {
     if (_meshFilter != null || _terrain != null)
     {
         if (IsTerrain())
         {
             _terrain.enabled = true;
         }
         GlobalProjectorManager.Get().AddReceiver(this);
     }
 }
Beispiel #12
0
 void OnDisable()
 {
     if (GlobalProjectorManager.Exists())
     {
         GlobalProjectorManager.Get().RemoveProjector(this);
         if (_ShadowDummy != null)
         {
             _Renderer.enabled = false;
         }
     }
 }
 void RemoveReceiver()
 {
     if (GlobalProjectorManager.Exists())
     {
         if (_meshFilter != null || _terrain != null)
         {
             if (IsTerrain())
             {
                 _terrain.enabled = false;
             }
             GlobalProjectorManager.Get().RemoveReceiver(this);
         }
     }
 }
 void OnDestroy()
 {
     _Instance = null;
 }
Beispiel #15
0
 // Token: 0x060001DD RID: 477 RVA: 0x0001AFC8 File Offset: 0x000191C8
 private void OnEnable()
 {
     GlobalProjectorManager.Get().AddProjector(this);
 }
Beispiel #16
0
 // Token: 0x060001DC RID: 476 RVA: 0x0001AFB8 File Offset: 0x000191B8
 private void Start()
 {
     GlobalProjectorManager.Get().AddProjector(this);
 }
Beispiel #17
0
 void OnEnable()
 {
     GlobalProjectorManager.Get().AddProjector(this);
     _Renderer.enabled = true;
 }