Beispiel #1
0
        internal void Destroy()
        {
            _currentChunk = null;

            prototype = null;

            System.GC.SuppressFinalize(this);
        }
        protected override void OnChunkCreated(Chunk chunk)
        {
            base.OnChunkCreated(chunk);

            FoliageChunk FoliageChunkInstance = chunk as FoliageChunk;

            if (FoliageChunkInstance != null)
            {
                FoliageChunks.Add(FoliageChunkInstance);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Remove an existing Foliage prototype.
        /// </summary>
        public void RemovePrototype(FoliagePrototype prototype)
        {
            _prototypes.Remove(prototype);
            sortedPrototypes.Remove(prototype.id);

            FoliageCore_MainManager.DestroyMeshInstance(prototype.id);
            FoliageCore_MainManager.RemoveGrassMap(prototype);

            #if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                UnityEditor.EditorUtility.SetDirty(this);
            }
            #endif

            FoliageChunk.OnPrototypeDeleted(prototype.id);

            System.GC.SuppressFinalize(prototype);
        }
Beispiel #4
0
        /// <summary>
        /// Add a new Foliage prototype.
        /// </summary>
        public void AddPrototype(Texture2D texture, GameObject prefab, float minWidth, float minHeight, float maxWidth, float maxHeight, float spread, int layer, Color healthyColor, Color dryColor)
        {
            int id = lastID;

            FoliagePrototype.CreatePrototype(texture, prefab, minWidth, minHeight, maxWidth, maxHeight, spread, layer, id, healthyColor, dryColor);

            FoliageCore_MainManager.GenerateFoliageMeshInstances(id);

            FoliageChunk.OnPrototypeCreated(id);

            #if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                UnityEditor.EditorUtility.SetDirty(this);
            }
            #endif

            lastID++;
        }
Beispiel #5
0
 protected virtual void OnLastFoliageChunkChanged(FoliageChunk oldChunk, FoliageChunk newChunk)
 {
     interactionMap.RecalculateInteractions(this);
 }