Example #1
0
        /// <summary>
        /// Handle tile destruction event and propagate it to modifier stacks
        /// </summary>
        /// <param name="tile">Destroyed tile object</param>
        public override void OnUnregisterTile(UnityTile tile)
        {
            base.OnUnregisterTile(tile);
            if (_activeCoroutines.ContainsKey(tile))
            {
                foreach (var cor in _activeCoroutines[tile])
                {
                    Runnable.Stop(cor);
                }
            }
            _activeCoroutines.Remove(tile);

            if (_defaultStack != null)
            {
                _defaultStack.UnregisterTile(tile);
            }

            //removing ids from activeIds list so they'll be recreated next time tile loads (necessary when you're unloading/loading tiles)
            if (_idPool.ContainsKey(tile))
            {
                foreach (var item in _idPool[tile])
                {
                    _activeIds.Remove(item);
                }
                _idPool[tile].Clear();
            }
        }
        /// <summary>
        /// Handle tile destruction event and propagate it to modifier stacks
        /// </summary>
        /// <param name="tile">Destroyed tile object</param>
        public override void OnUnregisterTile(UnityTile tile)
        {
            base.OnUnregisterTile(tile);
            if (_activeCoroutines.ContainsKey(tile))
            {
                foreach (var cor in _activeCoroutines[tile])
                {
                    Runnable.Stop(cor);
                }
            }
            _activeCoroutines.Remove(tile);

            if (_defaultStack != null)
            {
                _defaultStack.UnregisterTile(tile);
            }

            //removing ids from activeIds list so they'll be recreated next time tile loads (necessary when you're unloading/loading tiles)
            if (_idPool.ContainsKey(tile))
            {
                foreach (var item in _idPool[tile])
                {
                    // remove pois from all dictionaries and delete offscreen indicators
                    var removePoi    = false;
                    var removePoiKey = "";
                    foreach (var poiKey in pos.Keys)
                    {
                        if (poiKey.Contains(item.ToString()))
                        {
                            removePoi    = true;
                            removePoiKey = poiKey;
                            break;
                        }
                    }
                    if (removePoi)
                    {
                        pos.Remove(removePoiKey);
                        typeDict.Remove(removePoiKey);
                        if (GameObject.Find("ind" + item.ToString()))
                        {
                            Destroy(GameObject.Find("ind" + item.ToString()));
                        }
                    }

                    _activeIds.Remove(item);
                }
                _idPool[tile].Clear();
            }
        }
Example #3
0
        /// <summary>
        /// Handle tile destruction event and propagate it to modifier stacks
        /// </summary>
        /// <param name="tile">Destroyed tile object</param>
        public override void OnUnregisterTile(UnityTile tile)
        {
            base.OnUnregisterTile(tile);
            tile.VectorDataState = Enums.TilePropertyState.Cancelled;
            if (_activeCoroutines.ContainsKey(tile))
            {
                foreach (var cor in _activeCoroutines[tile])
                {
                    Runnable.Stop(cor);
                }
            }

            if (_defaultStack != null)
            {
                _defaultStack.UnregisterTile(tile);
            }
            foreach (var val in Stacks)
            {
                if (val != null && val.Stack != null)
                {
                    val.Stack.UnregisterTile(tile);
                }
            }
        }