コード例 #1
0
        public void DisposeRuntimePrefabSystem()
        {
            for (int i = 0; i <= PackageRuntimePrefabInfoList.Count - 1; i++)
            {
                VegetationPackageRuntimePrefabInfo packageRuntimePrefabInfo = PackageRuntimePrefabInfoList[i];
                for (int j = 0; j <= packageRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; j++)
                {
                    VegetationItemRuntimePrefabInfo vegetationItemRuntimePrefabInfo =
                        packageRuntimePrefabInfo.RuntimePrefabManagerList[j];

                    for (int k = 0; k <= vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; k++)
                    {
                        RuntimePrefabManager runtimePrefabManager =
                            vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList[k];
                        runtimePrefabManager?.Dispose();
                    }
                }

                packageRuntimePrefabInfo.RuntimePrefabManagerList.Clear();
            }

            PackageRuntimePrefabInfoList.Clear();
            VisibleVegetationCellSelector?.Dispose();
            VisibleVegetationCellSelector = null;
            DestroyRuntimePrefabParent();
        }
コード例 #2
0
ファイル: RuntimePrefabSpawner.cs プロジェクト: d-oglesby/VS
        private void OnRenderComplete(VegetationSystemPro vegetationSystemPro)
        {
            if (PackageRuntimePrefabInfoList.Count == 0)
            {
                return;
            }

            TestFloatingOrigin();

            UnityEngine.Profiling.Profiler.BeginSample("Runtime prefab system processing");
            JobHandle cullingJobHandle = default(JobHandle);

            for (int i = 0; i <= PackageRuntimePrefabInfoList.Count - 1; i++)
            {
                VegetationPackageRuntimePrefabInfo packageRuntimePrefabInfo = PackageRuntimePrefabInfoList[i];
                for (int j = 0; j <= packageRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; j++)
                {
                    VegetationItemRuntimePrefabInfo vegetationItemRuntimePrefabInfo =
                        packageRuntimePrefabInfo.RuntimePrefabManagerList[j];

                    for (int k = 0; k <= vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; k++)
                    {
                        RuntimePrefabManager runtimePrefabManager =
                            vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList[k];
                        if (runtimePrefabManager == null)
                        {
                            continue;
                        }
                        cullingJobHandle =
                            runtimePrefabManager.VegetationItemSelector.ProcessInvisibleCells(cullingJobHandle);
                        cullingJobHandle =
                            runtimePrefabManager.VegetationItemSelector.ProcessVisibleCells(cullingJobHandle);
                        cullingJobHandle = runtimePrefabManager.VegetationItemSelector.ProcessCulling(cullingJobHandle);
                    }
                }
            }

            cullingJobHandle.Complete();

            for (int i = 0; i <= PackageRuntimePrefabInfoList.Count - 1; i++)
            {
                VegetationPackageRuntimePrefabInfo packageRuntimePrefabInfo = PackageRuntimePrefabInfoList[i];
                for (int j = 0; j <= packageRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; j++)
                {
                    VegetationItemRuntimePrefabInfo vegetationItemRuntimePrefabInfo =
                        packageRuntimePrefabInfo.RuntimePrefabManagerList[j];

                    for (int k = 0; k <= vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; k++)
                    {
                        RuntimePrefabManager runtimePrefabManager =
                            vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList[k];
                        runtimePrefabManager?.VegetationItemSelector.ProcessEvents();
                    }
                }
            }

            UnityEngine.Profiling.Profiler.EndSample();
        }
コード例 #3
0
        public void SetRuntimePrefabVisibility(bool value)
        {
            for (int i = 0; i <= PackageRuntimePrefabInfoList.Count - 1; i++)
            {
                VegetationPackageRuntimePrefabInfo packageRuntimePrefabInfo = PackageRuntimePrefabInfoList[i];
                for (int j = 0; j <= packageRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; j++)
                {
                    VegetationItemRuntimePrefabInfo vegetationItemRuntimePrefabInfo =
                        packageRuntimePrefabInfo.RuntimePrefabManagerList[j];

                    for (int k = 0; k <= vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; k++)
                    {
                        RuntimePrefabManager runtimePrefabManager =
                            vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList[k];
                        runtimePrefabManager?.SetRuntimePrefabVisibility(value);
                    }
                }
            }
        }
コード例 #4
0
        public void UpdateCullingDistance()
        {
            for (int i = 0; i <= PackageRuntimePrefabInfoList.Count - 1; i++)
            {
                VegetationPackageRuntimePrefabInfo packageRuntimePrefabInfo = PackageRuntimePrefabInfoList[i];
                for (int j = 0; j <= packageRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; j++)
                {
                    VegetationItemRuntimePrefabInfo vegetationItemRuntimePrefabInfo =
                        packageRuntimePrefabInfo.RuntimePrefabManagerList[j];

                    for (int k = 0; k <= vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; k++)
                    {
                        RuntimePrefabManager runtimePrefabManager =
                            vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList[k];
                        runtimePrefabManager?.UpdateRuntimePrefabDistance();
                    }
                }
            }
        }
コード例 #5
0
        private void OnClearCacheVegetationCell(VegetationSystemPro vegetationSystemPro, VegetationCell vegetationCell)
        {
            for (int i = 0; i <= PackageRuntimePrefabInfoList.Count - 1; i++)
            {
                VegetationPackageRuntimePrefabInfo packageRuntimePrefabInfo = PackageRuntimePrefabInfoList[i];
                for (int j = 0; j <= packageRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; j++)
                {
                    VegetationItemRuntimePrefabInfo vegetationItemRuntimePrefabInfo =
                        packageRuntimePrefabInfo.RuntimePrefabManagerList[j];

                    for (int k = 0; k <= vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; k++)
                    {
                        RuntimePrefabManager runtimePrefabManager =
                            vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList[k];
                        runtimePrefabManager?.VegetationItemSelector.RefreshVegetationCell(vegetationCell);
                    }
                }
            }
        }
コード例 #6
0
ファイル: RuntimePrefabSpawner.cs プロジェクト: d-oglesby/VS
        void UpdateFloatingOrigin(Vector3 deltaFloatingOriginOffset)
        {
            for (int i = 0; i <= PackageRuntimePrefabInfoList.Count - 1; i++)
            {
                VegetationPackageRuntimePrefabInfo packageRuntimePrefabInfo = PackageRuntimePrefabInfoList[i];
                for (int j = 0; j <= packageRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; j++)
                {
                    VegetationItemRuntimePrefabInfo vegetationItemRuntimePrefabInfo =
                        packageRuntimePrefabInfo.RuntimePrefabManagerList[j];

                    for (int k = 0; k <= vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; k++)
                    {
                        RuntimePrefabManager runtimePrefabManager =
                            vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList[k];
                        runtimePrefabManager?.RuntimePrefabStorage.UpdateFloatingOrigin(deltaFloatingOriginOffset);
                    }
                }
            }
        }
コード例 #7
0
        public void SetupRuntimePrefabSystem()
        {
            if (!VegetationSystemPro)
            {
                return;
            }

            DisposeRuntimePrefabSystem();
            CreateRuntimePrefabParent();

            VisibleVegetationCellSelector = new VisibleVegetationCellSelector();

            for (int i = 0; i <= VegetationSystemPro.VegetationPackageProList.Count - 1; i++)
            {
                VegetationPackagePro vegetationPackagePro = VegetationSystemPro.VegetationPackageProList[i];
                VegetationPackageRuntimePrefabInfo vegetationPackageRuntimePrefabInfo =
                    new VegetationPackageRuntimePrefabInfo();

                for (int j = 0; j <= vegetationPackagePro.VegetationInfoList.Count - 1; j++)
                {
                    VegetationItemInfoPro vegetationItemInfoPro = vegetationPackagePro.VegetationInfoList[j];

                    VegetationItemRuntimePrefabInfo vegetationItemRuntimePrefabInfo =
                        new VegetationItemRuntimePrefabInfo();

                    for (int k = 0; k <= vegetationItemInfoPro.RuntimePrefabRuleList.Count - 1; k++)
                    {
                        RuntimePrefabRule    runtimePrefabRule    = vegetationItemInfoPro.RuntimePrefabRuleList[k];
                        RuntimePrefabManager runtimePrefabManager =
                            new RuntimePrefabManager(VisibleVegetationCellSelector, VegetationSystemPro,
                                                     vegetationItemInfoPro, runtimePrefabRule, _runtimePrefabParent, ShowRuntimePrefabs);
                        vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList.Add(runtimePrefabManager);
                    }

                    vegetationPackageRuntimePrefabInfo.RuntimePrefabManagerList.Add(vegetationItemRuntimePrefabInfo);
                }

                PackageRuntimePrefabInfoList.Add(vegetationPackageRuntimePrefabInfo);
            }

            VisibleVegetationCellSelector.Init(VegetationSystemPro);
        }
コード例 #8
0
        public int GetVisibleColliders()
        {
            int instanceCount = 0;

            for (int i = 0; i <= PackageRuntimePrefabInfoList.Count - 1; i++)
            {
                VegetationPackageRuntimePrefabInfo packageRuntimePrefabInfo = PackageRuntimePrefabInfoList[i];
                for (int j = 0; j <= packageRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; j++)
                {
                    VegetationItemRuntimePrefabInfo vegetationItemRuntimePrefabInfo =
                        packageRuntimePrefabInfo.RuntimePrefabManagerList[j];

                    for (int k = 0; k <= vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; k++)
                    {
                        RuntimePrefabManager runtimePrefabManager =
                            vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList[k];
                        instanceCount += runtimePrefabManager.RuntimePrefabStorage.RuntimePrefabInfoList.Count;
                    }
                }
            }

            return(instanceCount);
        }
コード例 #9
0
        public int GetLoadedInstanceCount()
        {
            int instanceCount = 0;

            for (int i = 0; i <= PackageRuntimePrefabInfoList.Count - 1; i++)
            {
                VegetationPackageRuntimePrefabInfo packageRuntimePrefabInfo = PackageRuntimePrefabInfoList[i];
                for (int j = 0; j <= packageRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; j++)
                {
                    VegetationItemRuntimePrefabInfo vegetationItemRuntimePrefabInfo =
                        packageRuntimePrefabInfo.RuntimePrefabManagerList[j];

                    for (int k = 0; k <= vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; k++)
                    {
                        RuntimePrefabManager runtimePrefabManager =
                            vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList[k];
                        instanceCount += runtimePrefabManager.VegetationItemSelector.InstanceList.Length;
                    }
                }
            }

            return(instanceCount);
        }
コード例 #10
0
        private void OnClearCacheVegetationItem(VegetationSystemPro vegetationSystemPro, int vegetationPackageIndex,
                                                int vegetationItemIndex)
        {
            for (int i = 0; i <= PackageRuntimePrefabInfoList.Count - 1; i++)
            {
                VegetationPackageRuntimePrefabInfo packageRuntimePrefabInfo = PackageRuntimePrefabInfoList[i];
                for (int j = 0; j <= packageRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; j++)
                {
                    if (i == vegetationPackageIndex && j == vegetationItemIndex)
                    {
                        VegetationItemRuntimePrefabInfo vegetationItemRuntimePrefabInfo =
                            packageRuntimePrefabInfo.RuntimePrefabManagerList[j];

                        for (int k = 0; k <= vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList.Count - 1; k++)
                        {
                            RuntimePrefabManager runtimePrefabManager =
                                vegetationItemRuntimePrefabInfo.RuntimePrefabManagerList[k];
                            runtimePrefabManager?.VegetationItemSelector.RefreshAllVegetationCells();
                        }
                    }
                }
            }
        }