private void OnDestroyGold(DestroyGoldMessage message) { for (int i = 0; i < _goldInstances.Count; i++) { if (message.EntityId == _goldInstances[i].EntityId) { Destroy(_goldInstances[i].gameObject); } } }
public void DestroyGold(int entityId) { for (int i = 0; i < _gold.Count; ++i) { if (_gold[i].EntityId == entityId) { var message = new DestroyGoldMessage(); message.EntityId = _gold[i].EntityId; _messageRouter.RaiseMessage(message); _gold.RemoveAt(i); break; } } }