public void OnCreate(GameObject sender, EventArgs args) { if (CurrentCloneChampions.Count > 0) { if (sender.IsEnemy) { var baseObject = sender as Obj_AI_Base; if (baseObject != null) { if (CurrentCloneChampions.Any(cloneChamp => baseObject.Name == cloneChamp.Name)) { CurrentClones.Add(baseObject); } } } } }
private void OnCreate(GameObject sender, EventArgs args) { // Check if there are clone champs if (CurrentCloneChampions.Count > 0) { // Check if the created object is an enemy if (sender.IsEnemy) { // Check if the object is a least a base object var baseObject = sender as Obj_AI_Base; if (baseObject != null) { // Check if the base object could be one of the enemy clones if (CurrentCloneChampions.Any(cloneChamp => baseObject.Name == cloneChamp.Name)) { // Add the revealed clone to the current clones CurrentClones.Add(baseObject); } } } } }