public Tower PrepareNewTower(Tower.Type type) { Tower tower = null; List <Object> towerTemplates; bool found = m_TowerTemplates.TryGetValue(type, out towerTemplates); Assert.IsTrue(found); if (found) { tower = new Tower(); tower.Init(); foreach (GameObject towerObject in towerTemplates) { TowerLevel newLevel = towerObject.GetComponent <TowerLevel>(); tower.AddLevel(newLevel); } tower.PrepareToPlace(); } return(tower); }