public void ResetGame() { Map.ClearMapCells(); Snake.Length = GlobalStorage.Instance.Default_SnakeLength; Snake.M_HeadPosition = new Vector2Int(Map.Size.x / 2, Map.Size.y / 2); Food.ReplaceOnMap(); GameParams.Points = 0; RefreshGameParams(); }
public void OnSnakeCollision(Snake sender, object collide_with) { if (collide_with is FoodBase) { FoodBase food = collide_with as FoodBase; if (GlobalStorage.Instance.CurrentMap.FreeCellsCount > 1) { food.ReplaceOnMap(); Snake.Length++; SetPlayerPoints(Snake.Length - GlobalStorage.Instance.Default_SnakeLength); if (Snake.Length == Snake.NodePool.PoolCapacity) { GameFinished(true); } } } }