Beispiel #1
0
 private void StateChangedMethod(CullingGroupEvent evt)
 {
     if (evt.isVisible)
     {
         this.isVisibleBoundingSpheres[evt.index] = true;
     }
     else
     {
         this.isVisibleBoundingSpheres[evt.index] = false;
     }
     if (evt.currentDistance == 2)
     {
         GrassCell grassCell = this.Cells[evt.index];
         if (grassCell.state != 2)
         {
             int cellContentCount = grassCell.CellContentCount;
             for (int i = 0; i < cellContentCount; i++)
             {
                 this.CellContent[grassCell.CellContentIndexes[i]].ReleaseCellContent();
             }
             if (grassCell.state == 1)
             {
                 this.CellsOrCellContentsToInit.Remove(grassCell.index);
             }
             grassCell.state = 0;
         }
     }
 }
Beispiel #2
0
    private void StateChangedMethod(CullingGroupEvent evt)
    {
        bool flag = false;

        for (int i = 0; i < this.heightSphereNumber; i++)
        {
            if (this.group.IsVisible(i))
            {
                flag = true;
                break;
            }
        }
        if (flag)
        {
            this.terrain.drawHeightmap = true;
            if (this.disableTrees)
            {
                this.terrain.drawTreesAndFoliage = true;
            }
        }
        else
        {
            this.terrain.drawHeightmap = false;
            if (this.disableTrees)
            {
                this.terrain.drawTreesAndFoliage = false;
            }
        }
    }
Beispiel #3
0
            void OnStateChanged(CullingGroupEvent evt)
            {
                if (evt.isVisible != evt.wasVisible || evt.currentDistance != evt.previousDistance)
                {
                    if (evt.isVisible && evt.currentDistance == 0)
                    {
                        if (visible.Add(evt.index))
                        {
                            //if (lifetime[evt.index] < Time.time)
                            //{
                            frames[evt.index].w = Time.time + frames[evt.index].z;
                            //}
                            isDirty = true;
                        }
                    }
                    else if (!evt.isVisible || evt.currentDistance > 1)
                    {
                        if (visible.Remove(evt.index))
                        {
                            isDirty = true;

                            /*if (lifetime[evt.index] < Time.time)
                             * {
                             *      lifetime[evt.index] = Time.time + 10;
                             * }*/
                        }
                    }
                }
            }
        /// <summary>
        /// Event on cilling group change
        /// </summary>
        /// <param name="evt">Evt.</param>
        private void StateChangedMethod(CullingGroupEvent evt)
        {
            bool visible = false;

            for (int i = 0; i < heightSphereNumber; i++)
            {
                if (group.IsVisible(i))
                {
                    visible = true;
                    break;
                }
            }

            if (visible)
            {
                terrain.drawHeightmap = true;
                if (disableTrees)
                {
                    terrain.drawTreesAndFoliage = true;
                }
            }
            else
            {
                terrain.drawHeightmap = false;
                if (disableTrees)
                {
                    terrain.drawTreesAndFoliage = false;
                }
            }
        }
Beispiel #5
0
        // object state has changed in culling group
        void StateChanged(CullingGroupEvent e)
        {
            if (colorInvisibleObjects == true && e.isVisible == false)
            {
                objects[e.index].material.color = culledColor;
                return;
            }

            /*
             * // if we are in distance band index 0, that is between 0 to searchDistance
             * if (e.currentDistance == 0)
             * {
             *  objects[e.index].material.color = Color.green;
             * }
             * else // too far, set color to red
             * {
             *  objects[e.index].material.color = Color.red;
             * }*/

            int distanceBand = e.currentDistance;

            if (distanceBand > distanceColors.Length - 1)
            {
                distanceBand = distanceColors.Length - 1;
            }

            objects[e.index].material.color = distanceColors[distanceBand];
        }
Beispiel #6
0
 void OnStateChanged(CullingGroupEvent sphere)
 {
     Cull(sphere.isVisible);
     print(sphere.index);
     print("Has become invisible: " + sphere.hasBecomeInvisible.ToString());
     Debug.Break();
 }
Beispiel #7
0
    void OnStateChange(CullingGroupEvent evt)
    {
        var cullsystem = World.DefaultGameObjectInjectionWorld.GetExistingSystem <CullingSystem>();

        if (cullsystem != null)
        {
            if (evt.hasBecomeInvisible)
            {
                if (!CullIndexList.Contains(evt.index))
                {
                    CullIndexList.Add(evt.index);
                }
            }
            else if (evt.hasBecomeVisible)
            {
                int index = evt.index;
                // Stopwatch sw = new Stopwatch();
                // sw.Start();
                // UnityEngine.Debug.Log("hasBecomeVisible " + index);
                //EntityMgr.CreateEntitiesByList(posList[index], rotList[index], index);
                CreateIndexList.Add(index);
                // sw.Stop();
                // UnityEngine.Debug.Log(string.Format("create total: {0} ms  {1}", sw.ElapsedMilliseconds, index));
            }
        }
    }
Beispiel #8
0
    private void StateChangedMethod(CullingGroupEvent evt)
    {
        if (evt.hasBecomeVisible)
        {
            Debug.Log(group.IsVisible(0) + " Checking vis");
            foreach (GameObject item in Culling)
            {
                item.SetActive(false);
            }
        }
        else if (evt.hasBecomeInvisible)
        {
            Debug.Log(group.IsVisible(0) + " Checking vis");
            foreach (GameObject item in Culling)
            {
                item.SetActive(true);
            }
        }

        /*
         *  else if (Room2_Cam.enabled == true && Room1_Cam.enabled == false && MainCam_.enabled == false)
         *  {
         *      Debug.Log("Testing _2");
         *      foreach (GameObject item in Room1_cGroup)
         *      {
         *          item.SetActive(false);
         *      }
         *      foreach (GameObject item in Room2_cGroup)
         *      {
         *          item.SetActive(true);
         *      }
         *  }
         *   if (Room2_Cam.enabled) && Room1_Cam.enabled == false && Room2_Cam.enabled == false
         *  {
         *      Debug.Log("Testing _3");
         * //                foreach (GameObject item in Room1_cGroup)
         * //                {
         * //                    item.SetActive(false);
         * //                }
         * //                foreach (GameObject item in Room2_cGroup)
         * //               {
         * //                  item.SetActive(false);
         * //             }
         *  }
         * }
         *
         *
         * else if (evt.hasBecomeInvisible)
         * {
         *  foreach (GameObject item in Room1_cGroup)
         *  {
         *      item.SetActive(true);
         *  }
         *  foreach (GameObject item in Room2_cGroup)
         *  {
         *      item.SetActive(true);
         *  }
         * } */
    }
Beispiel #9
0
    private void OnChange(CullingGroupEvent ev)
    {
        targets[ev.index].gameObject.SetActive(ev.isVisible);

        if (ev.currentDistance > fov)
        {
            targets[ev.index].gameObject.SetActive(false);
        }
    }
        public void HandleCullingStateChange(CullingGroupEvent evt)
        {
            int index = evt.index;

            if (boundingSpheresDic.ContainsKey(index))
            {
                boundingSpheresDic[index].OnCullingStateChange(evt.isVisible);
            }
        }
Beispiel #11
0
 internal virtual void OnStateChanged(CullingGroupEvent sphere)
 {
     if (renderCache.Visible[sphere.index] != sphere.isVisible)
     {
         renderCache.VisibleCount         += sphere.isVisible?1:-1;
         renderCache.VisiblityChanged      = true;
         renderCache.Visible[sphere.index] = sphere.isVisible;
     }
 }
        void OnCullingEvent(CullingGroupEvent ev)
        {
            var target = targets[ev.index];

            if (target != null)
            {
                target.image.enabled = ev.isVisible;
                target.tweenAnim.SetPlay(ev.isVisible);
            }
        }
 public void UpdatePatchState(CullingGroupEvent Event)
 {
     for (int y = 0; y < LayerPatches [0].LODRenderers.Length; y++)
     {
         if ((y != LODIndex && LayerPatches [0].LODRenderers [y].enabled) || (y == LODIndex) || !Event.isVisible)
         {
             SetLODState(y, (ShouldRender [0] && y == LODIndex && Event.isVisible), (Event.hasBecomeVisible || Event.hasBecomeInvisible));
         }
     }
 }
Beispiel #14
0
 void OnStateChanged(CullingGroupEvent sphere)
 {
     if (sphere.isVisible)
     {
         target.Play(true);
     }
     else
     {
         target.Pause();
     }
 }
Beispiel #15
0
 void OnChange(CullingGroupEvent ev)
 {
     if (ev.isVisible && ev.currentDistance < 3)
     {
         targets[ev.index].dynamLoadRes.LoadRes();
     }
     else
     {
         targets[ev.index].dynamLoadRes.UnLoadRes();
     }
 }
Beispiel #16
0
 void OnStateChanged(CullingGroupEvent cullEvent)
 {
     if (cullEvent.isVisible)
     {
         faerieParticles.Play(true);
     }
     else
     {
         faerieParticles.Pause();
     }
 }
 private void StateChangedMethod(CullingGroupEvent evt)
 {
     if (evt.hasBecomeVisible)
     {
         Debug.LogFormat("Sphere {0} has become visible!", evt.index);
     }
     if (evt.hasBecomeInvisible)
     {
         Debug.LogFormat("Sphere {0} has become invisible!", evt.index);
     }
 }
Beispiel #18
0
 void OnChange(CullingGroupEvent ev)
 {
     if (ev.currentDistance > 0)
     {
         targets[ev.index].gameObject.GetComponent <Renderer>().material.color = Color.green;
     }
     else
     {
         targets[ev.index].gameObject.GetComponent <Renderer>().material.color = Color.red;
     }
 }
Beispiel #19
0
 void onCullingChanged(CullingGroupEvent evt)
 {
     if (evt.hasBecomeInvisible)
     {
         items[evt.index].gameObject.SetActive(false);
     }
     else if (evt.hasBecomeVisible)
     {
         items[evt.index].gameObject.SetActive(true);
     }
 }
 void OnDecalCullingChanged(CullingGroupEvent sphere)
 {
     if (sphere.isVisible && !_VisibleDecalIndexCahce.Contains(sphere.index))
     {
         _VisibleDecalIndexCahce.Add(sphere.index);
     }
     else if (!sphere.isVisible && _VisibleDecalIndexCahce.Contains(sphere.index))
     {
         _VisibleDecalIndexCahce.Remove(sphere.index);
     }
 }
Beispiel #21
0
 void OnStateChanged(CullingGroupEvent sphere)
 {
     //Check if the particle system is within the screen
     if (sphere.isVisible)
     {
         target.Play(true);
     }
     else
     {
         target.Pause();
     }
 }
Beispiel #22
0
 void OnStateChanged(CullingGroupEvent cullEvent)
 {
     Debug.Log($"cullEvent {cullEvent.isVisible}");
     if (cullEvent.isVisible)
     {
         pSystem.Play(true);
     }
     else
     {
         pSystem.Pause();
     }
 }
Beispiel #23
0
        void OcclusionStateChangedMethod(CullingGroupEvent evt)
        {
            if (evt.hasBecomeVisible)
            {
                isOcclusionCulled = false;
            }

            if (evt.hasBecomeInvisible)
            {
                isOcclusionCulled = true;
            }
        }
    private void OnLodCullingGroupOnStateChangedHandler(CullingGroupEvent evt)
    {
        GPUSkinningPlayerMono player = players[evt.index];

        if (evt.isVisible)
        {
            SetLODMeshByDistanceIndex(evt.currentDistance, player.Player);
            player.Player.Visible = true;
        }
        else
        {
            player.Player.Visible = false;
        }
    }
Beispiel #25
0
 private void CullingStateChanged(CullingGroupEvent evt)
 {
     Debug.Assert(evt.index < usedBoundingSphereCount);
     if (evt.hasBecomeVisible)
     {
         Debug.Assert(evt.index < aniInstancingList.Count);
         aniInstancingList[evt.index].visible = true;
     }
     if (evt.hasBecomeInvisible)
     {
         Debug.Assert(evt.index < aniInstancingList.Count);
         aniInstancingList[evt.index].visible = false;
     }
 }
Beispiel #26
0
    void UpdateLods(CullingGroupEvent evt)
    {
        //Debug.Log(evt.index + ", " + evt.previousDistance + " > " + evt.currentDistance);
        int i = evt.index;

        if (evt.currentDistance == 0)
        {
            Lod.Add(InstancesArray[i]);
        }
        else
        {
            Lod.Remove(InstancesArray[i]);
        }
    }
Beispiel #27
0
        private void OnCullingChanged(CullingGroupEvent Event)
        {
            if (Patches != null)              // update LOD
            {
                GNS_Patch Patch = Patches[Event.index];
                if (Event.currentDistance < Manager.LODDistances.Count)
                {
                    Patch.LODIndex = Event.currentDistance;
                }

                OnPatchCullingChanged(Event);

                Patch.PreviousLODIndex = Patch.LODIndex;
            }
        }
Beispiel #28
0
    private void StateChangedMethod(CullingGroupEvent evt)
    {
        bool flag = false;

        if (this.group.GetDistance(0) == 0)
        {
            flag = true;
        }
        if (flag)
        {
            this.StopMovement();
            return;
        }
        this.StartMovement();
    }
Beispiel #29
0
 void OnStateChanged(CullingGroupEvent sphere)
 {
     if (sphere.isVisible)
     {
         // We could simulate forward a little here to hide that the system was not updated off-screen.
         target.Play(true);
         render.enabled = true;
         //Debug.Log("ParticlesEnabled");
     }
     else
     {
         target.Pause();
         render.enabled = false;
         //Debug.Log("ParticlesDisabled");
     }
 }
        private void OnCullStateChanged(CullingGroupEvent sphere)
        {
            var t = mCullingTarget[sphere.index];

            if (t.target == null)
            {
                return;
            }
            t.visible = sphere.isVisible;
            t.cullLv  = sphere.currentDistance;
            t.target.OnCulling(sphere.isVisible, sphere.currentDistance);
            if (OnCulling != null)
            {
                OnCulling(t.target, t.visible, t.cullLv);
            }
        }