Exemple #1
0
        public ColliderManager(VisibleVegetationCellSelector visibleVegetationCellSelector,
                               VegetationSystemPro vegetationSystemPro, VegetationItemInfoPro vegetationItemInfoPro,
                               Transform colliderParent, bool showColliders)
        {
            _showColliders         = showColliders;
            _vegetationSystemPro   = vegetationSystemPro;
            _vegetationItemInfoPro = vegetationItemInfoPro;

            float cullingDistance = vegetationSystemPro.VegetationSettings.GetVegetationDistance() *
                                    vegetationItemInfoPro.ColliderDistanceFactor;


            VegetationItemSelector = new VegetationItemSelector(visibleVegetationCellSelector, vegetationSystemPro,
                                                                vegetationItemInfoPro, false, 1, 0)
            {
                CullingDistance = cullingDistance
            };

            VegetationItemSelector.OnVegetationItemVisibleDelegate   += OnVegetationItemVisible;
            VegetationItemSelector.OnVegetationItemInvisibleDelegate += OnVegetationItemInvisible;
            VegetationItemSelector.OnVegetationCellInvisibleDelegate += OnVegetationCellInvisible;

            VegetationItemModelInfo vegetationItemModelInfo =
                vegetationSystemPro.GetVegetationItemModelInfo(vegetationItemInfoPro.VegetationItemID);

            ColliderPool         = new ColliderPool(vegetationItemInfoPro, vegetationItemModelInfo, vegetationSystemPro, colliderParent, _showColliders);
            RuntimePrefabStorage = new RuntimePrefabStorage(ColliderPool);
        }
        public RuntimePrefabManager(VisibleVegetationCellSelector visibleVegetationCellSelector,
                                    VegetationSystemPro vegetationSystemPro, VegetationItemInfoPro vegetationItemInfoPro, RuntimePrefabRule runtimePrefabRule,
                                    Transform prefabParent, bool showPrefabsInHierarchy)
        {
            _showPrefabsInHierarchy = showPrefabsInHierarchy;
            _vegetationSystemPro    = vegetationSystemPro;
            _runtimePrefabRule      = runtimePrefabRule;

            float cullingDistance = vegetationSystemPro.VegetationSettings.GetVegetationDistance() * runtimePrefabRule.DistanceFactor;

            VegetationItemSelector = new VegetationItemSelector(visibleVegetationCellSelector, vegetationSystemPro,
                                                                vegetationItemInfoPro, true, _runtimePrefabRule.SpawnFrequency, _runtimePrefabRule.Seed)
            {
                CullingDistance = cullingDistance
            };

            VegetationItemSelector.OnVegetationItemVisibleDelegate   += OnVegetationItemVisible;
            VegetationItemSelector.OnVegetationItemInvisibleDelegate += OnVegetationItemInvisible;
            VegetationItemSelector.OnVegetationCellInvisibleDelegate += OnVegetationCellInvisible;

            RuntimePrefabPool    = new RuntimePrefabPool(_runtimePrefabRule, vegetationItemInfoPro, prefabParent, _showPrefabsInHierarchy);
            RuntimePrefabStorage = new RuntimePrefabStorage(RuntimePrefabPool);
        }