internal void Start(double interval) { Stop(); m_Timer = new Timer(interval); m_Timer.Elapsed += OnTimedEvent; m_Timer.Start(); Log.I("Start the timer with {0} milliseconds.", interval); }
internal void Stop() { if (null != m_Timer) { Log.I("Stop the timer."); m_Timer.Elapsed -= OnTimedEvent; m_Timer.Stop(); m_Timer.Close(); m_Timer = null; } }
private void CheckImpression() { Log.I("Checking whether the {0} is viewable.", gameObject.name); Vector3 cameraRelative = Camera.main.transform.InverseTransformPoint(gameObject.transform.position); if (0 < cameraRelative.z) { Log.D("The {0} is in front of the camera.", gameObject.name); } else { Log.D("The {0} is behind the camera.", gameObject.name); return; } if (IsViewable()) { Log.I("The {0} is viewable!", gameObject.name); OnImpression(); } }