void OnDevicePoseStatusChanged(ObserverBehaviour behaviour, TargetStatus targetStatus) { var statusInfo = targetStatus.StatusInfo; if (statusInfo == StatusInfo.RELOCALIZING) { // If the status is Relocalizing, then start the timer if it isn't active if (!mRelocalizationStatusDelayTimer.Enabled) { mRelocalizationStatusDelayTimer.Start(); } } else { // If the status is not Relocalizing, then stop the timers if they are active if (mRelocalizationStatusDelayTimer.Enabled) { mRelocalizationStatusDelayTimer.Stop(); } if (mResetDeviceObserverTimer.Enabled) { mResetDeviceObserverTimer.Stop(); } // Clear the status message StatusMessage.Instance.Display(string.Empty); } }
protected new void Update() { base.Update(); //RaycastHit hitInfo; //Ray ray = new Ray(gameObject.transform.position - 0.1f*Vector3.forward, Vector2.zero); //Debug.DrawRay(gameObject.transform.position, Vector3.forward); RaycastHit2D hit = Physics2D.Raycast(gameObject.transform.position, Vector2.zero); if (hit.transform != null) { //Debug.Log(hit.transform.gameObject.name); ObserverBehaviour <Part> emitterObserver = hit.transform.gameObject.GetComponent <ObserverBehaviour <Part> >(); if (emitterObserver != null) { (Emitter as Projectile).Hit(emitterObserver.Emitter); } } }