public void RemoveUnit(GameData.Wreckage wreck) { List <WreckageView> views = new List <WreckageView>(m_ResourceContainer.GetComponentsInChildren <WreckageView>()); WreckageView view = views.Find((v) => v.wreck == wreck); Destroy(view.gameObject); }
public UnitView AddUnit(GameData.Wreckage wreck, Color tint) { GameObject goUnit = CreateUnit("Wreckage", m_ResourceContainer, wreck.id, new Vector2Int(wreck.position.x, wreck.position.y)); WreckageView view = goUnit.GetComponent <WreckageView>(); view.Initialize(wreck, tint); return(view); }