public void TransferTo(CritterName other) { if (other == null || !HasName()) { return; } other.critterName = critterName; other.generation = generation; if (other.IsEgg()) { other.generation += 1; } other.ApplyName(); }
private static void OnLayEgg(CritterName component, object data) { component.TransferTo((data as GameObject).GetComponent <CritterName>()); }
private static void OnSpawnedFrom(CritterName component, object data) { (data as GameObject).GetComponent <CritterName>()?.TransferTo(component); }