public void SetConnection(Connection c) { if (m_colors == null) { m_colors = new Dictionary <ConnectionType, Color> { { ConnectionType.STANDARD, new Color(1.0f, 1.0f, 0.4f) }, { ConnectionType.SHALLOWRIVER, new Color(0.4f, 0.5f, 0.9f) }, { ConnectionType.ROAD, new Color(0.8f, 0.5f, 0.2f) }, { ConnectionType.MOUNTAINPASS, new Color(0.5f, 0.2f, 0.6f) }, { ConnectionType.MOUNTAIN, new Color(0.2f, 0.2f, 0.3f) }, { ConnectionType.RIVER, new Color(0.2f, 0.2f, 0.9f) } }; } m_connection = c; var col = m_colors[c.ConnectionType]; var rend = GetComponent <LineRenderer>(); rend.startColor = col; rend.endColor = col; var rend2 = SpriteObj.GetComponent <SpriteRenderer>(); rend2.color = col; if (m_widget == null) { return; } m_widget.SetConnection(c); }