Beispiel #1
0
        private void UpdateFruit(FruitChangedEventArgs e)
        {
            if (!e.IsEaten)
            {
                _fruit = e.FruitUpdated;

                _fruitFrameworkElement = CanvasHelper.FruitControlFactory(_fruit, _scale);
                _sprites.Add(_fruitFrameworkElement);
                CanvasHelper.ResizeElement(_fruitFrameworkElement, _fruit.Size.Width * _scale, _fruit.Size.Height * _scale);
            }
            else
            {
                this._fruit = null;
                _sprites.Remove(_fruitFrameworkElement);
                _fruitFrameworkElement = null;
            }
        }