public Insect GetInsectData(InsectType insectType) { if (_createdInsects.ContainsKey(insectType)) { if (showMessages) { Debug.Log("Reusing " + insectType.ToString()); } return(_createdInsects[insectType] as Insect); } else { if (showMessages) { Debug.LogWarning("Creating " + insectType.ToString()); } Insect insect = new Insect(insectType); _createdInsects.Add(insectType, insect); return(insect); } }
public Insect GetInsectData(InsectType insectType) { if (_createdInsects.ContainsKey(insectType)) { if (showMessages) Debug.Log("Reusing " + insectType.ToString()); return _createdInsects[insectType] as Insect; } else { if (showMessages) Debug.LogWarning("Creating " + insectType.ToString()); Insect insect = new Insect(insectType); _createdInsects.Add(insectType, insect); return insect; } }