Example #1
0
        private void DefineIfReplacements()
        {
            Collisionables.Add(typeof(EmptyBlock), (gameAux, otherBlock) => { });
            Collisionables.Add(typeof(FoodBlock), (gameAux, otherBlock) =>
            {
                Console.WriteLine("Snake was on " + Snake + " when eated!");
                otherBlock.Collided(game);
                Snake.Collided(game);
                GenerateFood();
            });
            Collisionables.Add(typeof(SnakeBlock), (gameAux, otherBlock) =>
            {
                Console.WriteLine("Snake was on " + Snake + " when collisioned with " + otherBlock + "!");
                game.GameEnds();
            });

            MatrixFinderActions.Add(true, (x, y) => { return(new int[] { x, y }); });
            //MatrixFinderActions.Add(false, (x, y) => { return new int[] { x, y }; });

            ChangeSnakeDirectionActionSelector.Add(true, (newDirection) => { return(newDirection); });
            ChangeSnakeDirectionActionSelector.Add(false, (newDirection) => { return(Direction); });
        }