Esempio n. 1
0
        public void StartGame()
        {
            EndGame();
            GameOver = false;
            SnakeBody snakeBody = new SnakeBody(Direction.Right, SnakeBodyType.SnakeHead);

            _snakeBodies = new List <SnakeBody>();
            _fruit       = null;
            Score        = 0;
            _snakeBodies.Add(snakeBody);
            OnSnakeChanged(snakeBody, false);
            NextFruit();
        }
Esempio n. 2
0
        protected void OnSnakeChanged(SnakeBody snakeUpdated, bool killed)
        {
            var shipChanged = SnakeChanged;

            shipChanged?.Invoke(this, new SnakeChangedEventArgs(snakeUpdated, killed));
        }
Esempio n. 3
0
 public SnakeChangedEventArgs(SnakeBody snakeUpdated, bool killed)
 {
     SnakeUpdated = snakeUpdated;
     Killed       = killed;
 }