public void PlaceTreasure(GameObject treasure, Vector2 location) { treasures.Add(new KeyValuePair <Vector2, GameObject>(location, treasure)); CountChangedEvent?.Invoke(treasures.Count); treasure.transform.position = location; treasure.SetActive(true); }
public void DropTreasure(GameObject treasure, Vector2 location) { KeyValuePair <Vector2, GameObject> found = treasures.FirstOrDefault(obj => obj.Value == treasure); if (found.Key != null) { CountChangedEvent?.Invoke(treasures.Count); treasure.transform.position = location; treasure.SetActive(true); } }
public bool DestoryTreasure(GameObject treasure) { KeyValuePair <Vector2, GameObject> found = treasures.FirstOrDefault(obj => obj.Value == treasure); if (found.Key != null) { treasures.Remove(found); Destroy(found.Value); CountChangedEvent?.Invoke(treasures.Count); return(true); } return(false); }