Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Collision with another snake
- // Collision with body:
- if (otherBody.linked && otherBody != otherBody.snake.head)
- {
- Snake otherSnake = otherBody.snake;
- if (_snake.size > otherBody.snake.size)
- {
- int index = otherSnake.bodyParts.IndexOf(otherBody);
- otherSnake.RemoveBodiesUntil(index);
- _spawner.DestroyObject(otherBody.gridObject);
- _snake.AddBody();
- }
- else
- {
- _spawner.DestroyObject(headBody.gridObject);
- _snake.DeathBehaviour();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement