GetIndex() public method

public GetIndex ( int x, int y ) : int
x int
y int
return int
Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
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();
 }
Exemplo n.º 3
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();
 }