Example #1
0
 private void ClearSprites()
 {
     foreach (var pathSprite in _pathSprites)
     {
         OnSpriteRemoved?.Invoke(this, pathSprite);
     }
     _pathSprites.Clear();
 }
Example #2
0
 private void DieHandler()
 {
     _ship.OnMoved            -= ShipMovedHandler;
     _ship.OnPathChanged      -= OnPathChangedHandler;
     _ship.OnDirectionChanged -= DirectionChangedHandler;
     _ship.OnDie -= DieHandler;
     ClearSprites();
     OnSpriteRemoved?.Invoke(this, _shipSprite);
 }
        public System.Boolean Remove(Sprite sprite)
        {
            if (sprite == null)
            {
                throw new ArgumentNullException("sprite has null value!");
            }

            if (sprites.Remove(sprite))
            {
                OnSpriteRemoved?.Invoke(this, new SpriteEventArgs(sprite));

                OnCollectionChanged?.Invoke(this, EventArgs.Empty);

                return(true);
            }

            return(false);
        }