private void CheckForGameOver() { if (snakeX < 1 || snakeX >= fupixel.width - 1 || snakeY < 1 || snakeY >= fupixel.height - 1 || fupixel.pixels[fupixel.GetIndex(snakeX, snakeY)] == snakeColor) { Application.LoadLevel(0); } }
void Awake() { fupixel = gameObject.GetComponent <Fupixel>(); fupixel.ClearPixels(Color.black); snakeParts = new Queue <int>(); snakeX = fupixel.width / 2; snakeY = fupixel.height / 4; foodIndex = fupixel.GetIndex(snakeX, fupixel.height / 2); snakeParts.Enqueue(fupixel.GetIndex(snakeX, snakeY)); DrawWalls(); }
void Awake() { fupixel = gameObject.GetComponent<Fupixel>(); fupixel.ClearPixels(Color.black); snakeParts = new Queue<int>(); snakeX = fupixel.width / 2; snakeY = fupixel.height / 4; foodIndex = fupixel.GetIndex(snakeX, fupixel.height / 2); snakeParts.Enqueue(fupixel.GetIndex(snakeX, snakeY)); DrawWalls(); }