/// <summary>
        /// If snake has eaten normal feed then spawn new normal feed.
        /// If snake has eaten special feed restart special feed spawn timer.
        /// </summary>
        private void OnFeedEaten(EventArgs args)
        {
            FeedEatenEventArgs feedArgs = args as FeedEatenEventArgs;

            if (feedArgs.eatenFeedType == typeof(NormalFeed))
            {
                SpawnNormalFeed();
            }
            else if (feedArgs.eatenFeedType == typeof(SpecialFeed))
            {
                OnSpecialFeedExpired(null);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Adds score points when snake has eaten feed.
        /// </summary>
        private void OnFeedEaten(EventArgs args)
        {
            FeedEatenEventArgs feedArgs = args as FeedEatenEventArgs;

            if (feedArgs.eatenFeedType == typeof(NormalFeed))
            {
                score += 1;
            }
            else if (feedArgs.eatenFeedType == typeof(SpecialFeed))
            {
                score += 10;
            }

            _eventController.Dispatch <ScoreChangedEvent>(new ScoreChangedEventArgs(score));
        }