void FarmerDestroyed(Farmer farmer) { if (Farmers.Contains(farmer)) { Farmers.Remove(farmer); AllTokens.Remove(farmer); } }
public void RemoveToken(int objectIndex) { if (objectIndex > AllTokens.Count - 1 || objectIndex < 0) { return; } Token token = AllTokens[objectIndex]; AllTokens.Remove(token); Type listType = Heroes.GetListType(); if (listType.IsCompatibleWith(token.GetType())) { Heroes.Remove((Hero)token); InventoryUICell.instance.ForceUpdate(this, cellID); return; } listType = Enemies.GetListType(); if (listType.IsCompatibleWith(token.GetType())) { Enemies.Remove((Enemy)token); InventoryUICell.instance.ForceUpdate(this, cellID); return; } listType = Farmers.GetListType(); if (listType.IsCompatibleWith(token.GetType())) { Farmers.Remove((Farmer)token); InventoryUICell.instance.ForceUpdate(this, cellID); return; } if (typeof(Well).IsCompatibleWith(token.GetType())) { Well = null; InventoryUICell.instance.ForceUpdate(this, cellID); return; } InventoryUICell.instance.ForceUpdate(this, cellID); }