public void AddVegetationItemInstanceEx(string vegetationItemID, Vector3 position, Vector3 scale, Quaternion rotation, byte vegetationSourceID, float minimumDistance, float distanceFalloff)
        {
            PersistentVegetationInfo persistentVegetationInfo = GetPersistentVegetationInfo(vegetationItemID);

            if (persistentVegetationInfo == null)
            {
                persistentVegetationInfo = new PersistentVegetationInfo {
                    VegetationItemID = vegetationItemID
                };
                PersistentVegetationInfoList.Add(persistentVegetationInfo);
            }

            float closestDistance = CalculateClosestItemDistance(position, persistentVegetationInfo.VegetationItemList);

            if (closestDistance < minimumDistance)
            {
                return;
            }

            PersistentVegetationItem persistentVegetationItem = new PersistentVegetationItem
            {
                Position           = position,
                Rotation           = rotation,
                Scale              = scale,
                VegetationSourceID = vegetationSourceID,
                DistanceFalloff    = distanceFalloff
            };

            persistentVegetationInfo.AddPersistentVegetationItemInstance(ref persistentVegetationItem);
        }
        public void RemoveVegetationItemInstances(string vegetationItemID)
        {
            PersistentVegetationInfo persistentVegetationInfo = GetPersistentVegetationInfo(vegetationItemID);

            if (persistentVegetationInfo != null)
            {
                PersistentVegetationInfoList.Remove(persistentVegetationInfo);
            }
        }
        public void RemoveVegetationItemInstance(string vegetationItemID, Vector3 position, float minimumDistance)
        {
            PersistentVegetationInfo persistentVegetationInfo = GetPersistentVegetationInfo(vegetationItemID);

            if (persistentVegetationInfo == null)
            {
                return;
            }

            for (int i = persistentVegetationInfo.VegetationItemList.Count - 1; i >= 0; i--)
            {
                if (Vector3.Distance(persistentVegetationInfo.VegetationItemList[i].Position, position) <
                    minimumDistance)
                {
                    persistentVegetationInfo.VegetationItemList.RemoveAt(i);
                }
            }
        }
        public void RemoveVegetationItemInstances(string vegetationItemID, byte vegetationSourceID)
        {
            PersistentVegetationInfo persistentVegetationInfo = GetPersistentVegetationInfo(vegetationItemID);

            if (persistentVegetationInfo != null)
            {
                for (int i = persistentVegetationInfo.VegetationItemList.Count - 1; i >= 0; i--)
                {
                    if (persistentVegetationInfo.VegetationItemList[i].VegetationSourceID == vegetationSourceID)
                    {
                        persistentVegetationInfo.RemovePersistentVegetationInstanceAtIndex(i);
                    }
                }

                if (persistentVegetationInfo.VegetationItemList.Count == 0)
                {
                    PersistentVegetationInfoList.Remove(persistentVegetationInfo);
                }
            }
        }
        public void AddVegetationItemInstance(string vegetationItemID, Vector3 position, Vector3 scale, Quaternion rotation, byte vegetationSourceID, float distanceFalloff)
        {
            PersistentVegetationInfo persistentVegetationInfo = GetPersistentVegetationInfo(vegetationItemID);

            if (persistentVegetationInfo == null)
            {
                persistentVegetationInfo = new PersistentVegetationInfo {
                    VegetationItemID = vegetationItemID
                };
                PersistentVegetationInfoList.Add(persistentVegetationInfo);
            }

            PersistentVegetationItem persistentVegetationItem = new PersistentVegetationItem
            {
                Position           = position,
                Rotation           = rotation,
                Scale              = scale,
                VegetationSourceID = vegetationSourceID,
                DistanceFalloff    = distanceFalloff
            };

            persistentVegetationInfo.AddPersistentVegetationItemInstance(ref persistentVegetationItem);
        }
        /// <summary>
        /// RepositionCellItems is used to check all instances of a VegetationItem in a cell and confirm that they are located in the correct cell.
        /// </summary>
        /// <param name="cellIndex"></param>
        /// <param name="vegetationItemID"></param>
        public void RepositionCellItems(int cellIndex, string vegetationItemID)
        {
            PersistentVegetationInfo persistentVegetationInfo = PersistentVegetationStoragePackage.PersistentVegetationCellList[cellIndex].GetPersistentVegetationInfo(vegetationItemID);

            if (persistentVegetationInfo == null)
            {
                return;
            }

            List <PersistentVegetationItem> origialItemList = new List <PersistentVegetationItem>();

            origialItemList.AddRange(persistentVegetationInfo.VegetationItemList);
            persistentVegetationInfo.ClearCell();

            for (int i = 0; i <= origialItemList.Count - 1; i++)
            {
                AddVegetationItemInstance(vegetationItemID, origialItemList[i].Position + VegetationSystemPro.VegetationSystemPosition, origialItemList[i].Scale,
                                          origialItemList[i].Rotation, false, origialItemList[i].VegetationSourceID, origialItemList[i].DistanceFalloff, true);
            }

            VegetationItemIndexes indexes = VegetationSystemPro.GetVegetationItemIndexes(vegetationItemID);

            VegetationSystemPro.ClearCache(VegetationSystemPro.VegetationCellList[cellIndex], indexes.VegetationPackageIndex, indexes.VegetationItemIndex);
        }