// Update is called once per frame private void Update() { if (m_TacticalView != null) { Vector3 cameraPosition = m_TacticalView.GetCameraPosition(); int entryCount = m_TextBoxList.Count; List <CelestialBody> bodyList = m_TacticalView.GetClosestBodies(entryCount, m_CelestialFilter, cameraPosition); for (int index = 1; index <= entryCount; ++index) { ProximityObject proximityObject = m_TextBoxList[index - 1]; CelestialBody body = (bodyList.Count >= index) ? bodyList[index - 1] : null; bool selected = (m_SelectedCelestialID != 0 && proximityObject.GetCelestialID() == m_SelectedCelestialID) ? true : false; proximityObject.Set(body, cameraPosition, selected); m_CurrentCelestialBodies[proximityObject] = body; } } }
public void SelectProximityObject(ProximityObject proximityObject, bool lookAtTarget) { // Deselect old object if (m_SelectedProximityObject != null) { m_SelectedProximityObject.SetSelected(false); m_SelectedCelestialID = 0; } // Select new object m_SelectedProximityObject = proximityObject; if (m_SelectedProximityObject != null) { m_SelectedProximityObject.SetSelected(true); m_SelectedCelestialID = m_SelectedProximityObject.GetCelestialID(); //CelestialBody body = CelestialManager.GetInstance().GetCelestialBody( m_SelectedCelestialID ); if (null != m_TacticalView) { m_TacticalView.SetSelected(m_SelectedCelestialID, lookAtTarget); } } }