public static void PickUpDishFromLocation(DishSpawnLocation location) { if (Instance.FilledSpawnLocations.Contains(location) && location.Dish != null) { GivePlayerDish(location.Dish); location.Dish = null; Instance.FilledSpawnLocations.Remove(location); Instance.EmptySpawnLocations.Add(location); } else { Debug.LogError("did something go wrong here?"); } }
// TODO logic public void SpawnDishAtRandomLocation() { if (this.EmptySpawnLocations.Count == 0) { return; } Dish newDish = Instance.SpawnDish(); newDish.Rigidbody.gravityScale = 0f; newDish.gameObject.layer = (int)GameLayers.Scenery; int index = Random.Range(0, this.EmptySpawnLocations.Count); DishSpawnLocation location = this.EmptySpawnLocations[index]; this.EmptySpawnLocations.RemoveAt(index); this.FilledSpawnLocations.Add(location); location.Dish = newDish; newDish.transform.position = location.transform.position; }