public virtual void Replace() { if (replacingTile == null) { return; } GetComponentInParent <TileManager>().tiles[x, y] = replacingTile; replacingTile.SetCoords(x, y); replacingTile.transform.SetParent(transform.parent); if (Core.theCore != null) { Core.theTM.AddAssignmnets(GetAss(), -GetNumAss()); Core.theTM.AddAssignmnets(replacingTile.GetAss(), replacingTile.GetNumAss()); } // Stage on this list to avoid concurrent modification death! List <Resource> stuffToMove = new List <Resource>(); foreach (Resource resource in clutteredResources) { stuffToMove.Add(resource); } foreach (Resource resource in tidyResources) { stuffToMove.Add(resource); } foreach (Resource resource in stuffToMove) { if (resource != null) { resource.PutInRoom(replacingTile); } } replacingTile.bWarning = bWarning; replacingTile.SetTaskActive(taskbar.gameObject.activeSelf); GetComponentInParent <TileManager>().UpdateEdges(x, y); while (lizardsOnTile.Count != 0) { lizardsOnTile[0].SetTile(replacingTile); } Destroy(); }