private void movement(SnakeType snake, FoodType food, LevelType level) { PortalType portal; //If the food is in a portal, clear the portal if (level.tryGetPortal(food.Vector, out portal)) { portal.clearGrid(level); } //Else empty the old grid cell else { level.Grid.GetCell(food.Vector).emptyCell(); } //Add the movement vector to the current mouse vector Vector2 newLocation = food.Vector + MovementFunctions.calculateLocation(orientation); if (level.tryGetPortal(newLocation, out portal)) { if (!portal.IsFull) { food.Vector = newLocation; portal.fillPortal(food); } } else if (level.Grid.GetCell(newLocation).content == CellContent.snake) { if (classification == FoodClassification.threat) { snake.GameOver(this, new EventArgs()); } } else if (level.Grid.GetCell(newLocation).content == CellContent.empty) { food.Vector = newLocation; } food.fillGrid(level); }