public void RemoveUnit(GameData.Marker marker) { List <MarkerView> views = new List <MarkerView>(m_ResourceContainer.GetComponentsInChildren <MarkerView>()); MarkerView view = views.Find((v) => v.marker == marker); Destroy(view.gameObject); }
public UnitView AddUnit(GameData.Marker marker, Color tint) { GameObject goUnit = CreateUnit("Resource/" + marker.markerType.ToString(), m_MarkerContainer, marker.id, new Vector2Int(marker.position.x, marker.position.y)); MarkerView view = goUnit.GetComponent <MarkerView>(); view.Initialize(marker, tint); return(view); }