public void addBlockUI(object sender, EventArgs e) { BlockUI blockUI = new BlockUI(snake.GetBlock(snake.NumOfBlocks - 1), snake.Multi); canvas.Children.Add(blockUI.Rect); blocksUI.Add(blockUI); }
public SnakeUI(Canvas canvas, Snakee snake) { this.snake = snake; for (int i = 0; i < snake.NumOfBlocks; i++) { this.canvas = canvas; BlockUI blockUI = new BlockUI(snake.GetBlock(i), snake.Multi); canvas.Children.Add(blockUI.Rect); blocksUI.Add(blockUI); snake.BlockAdded += addBlockUI; } }