private Pickup SpawnPickup(PickupPattern pattern, bool isForeground) { var pickup = this.pickupPrefabs.Find(p => p.Type == pattern.Type).Instantiate(this.transform); this.currentPickups.Add(pickup); var tile = Board.Instance.GetTile(pattern.Coordinates); pickup.Initialise(tile, isForeground, this.HandlePickupDestroy); return(pickup); }
public Pickup AddBackgroundPickup(PickupPattern pattern) { var pickup = this.currentPickups.Find(p => p.CurrentTile.Coordinates == pattern.Coordinates); if (pickup == null) { pickup = this.SpawnPickup(pattern, false); pickup.Hide(true); return(pickup); } if (pickup.IsForeground) { return(null); } return(pickup); }