// Use this for initialization void Start() { approachDistancePhysics = approachDistance / GravityEngine.Instance().GetLengthScale(); lastDistance = Vector3.Distance(body1.transform.position, body2.transform.position); foreach (GameObject go in listeners) { IClosestApproach iClosest = go.GetComponent <IClosestApproach>(); if (iClosest == null) { Debug.LogError("Listener " + go.name + " missing IClosestApproach - will be ignored"); } } }
private void NotifyListeners(float distance) { foreach (GameObject go in listeners) { IClosestApproach iClosest = go.GetComponent <IClosestApproach>(); if (iClosest != null) { iClosest.OnClosestApproachTrigger(body1, body2, distance); } } // If there is a GE console, log there if (GEConsole.Instance() != null) { GEConsole.Instance().AddToHistory(string.Format("Closest approach={0}", distance)); } triggered = true; }