void ChangeCarrotPlayerAreaNow(int carrotIdToChange, int newAreaOwner, Operation operation) { if (_showDebugMessages) { Debug.Log("LOCAL > Mudando a area da cenoura<" + carrotIdToChange + ">"); } if (operation == Operation.Remove) { if (_showDebugMessages) { Debug.Log("LOCAL > Mudando a area da cenoura: " + carrotIdToChange + "para a área: " + newAreaOwner); } //deletando da lista que estava PlayerArea areaToRemoveFrom = GetPlayerAreaById(AreaFromThisCarrot(carrotIdToChange)); if (areaToRemoveFrom.CarrotsList.FirstOrDefault(cr => cr.Id == carrotIdToChange) == null) { if (_showDebugMessages) { Debug.Log("LOCAL > A cenoura<" + carrotIdToChange + "> já não existe mais nessa área<" + areaToRemoveFrom + ">"); } } else { areaToRemoveFrom.CarrotsList.Remove(GetCarrotById(carrotIdToChange)); areaToRemoveFrom.UpdateInterface(); } } if (operation == Operation.Add) { PlayerArea areaToAddCarrot = GetPlayerAreaById(newAreaOwner); if (areaToAddCarrot.CarrotsList.Where(cr => cr.Id == carrotIdToChange).FirstOrDefault() != null) { if (_showDebugMessages) { Debug.Log("LOCAL > A cenoura<" + carrotIdToChange + "> já está nessa área<" + newAreaOwner + ">"); } } else { areaToAddCarrot.CarrotsList.Add(GetCarrotById(carrotIdToChange)); areaToAddCarrot.UpdateInterface(); } } }