void Start() { MagnetSensor magnetSensor = FindObjectOfType <MagnetSensor> (); UnityEngine.Debug.Log("Start"); System.Console.WriteLine("Hello"); print("StartPring\n"); Debug.Log("DebugStart\n"); magnetSensor.OnCardboardTrigger += OnMagnetClicked; }
static void Main(string[] args) { Init(); MyStopWatch timer = new MyStopWatch(); Context context = new Context(); IRaspberryPiStates emptyState = new EmptyState(); IRaspberryPiStates fullState = new FullState(); IRaspberryPiStates notDoneState = new NotDoneState(); //Bluetooth bt = new Bluetooth(); //bt.Init(); JsonWriter writer = new JsonWriter(); context.setState(emptyState); writer.JsonWriterFunc("Emptystate", "0", "Start"); //bt.SendData("EmptyState"); while (ReferenceEquals(context.getState(), emptyState) || ReferenceEquals(context.getState(), fullState) || ReferenceEquals(context.getState(), notDoneState)) { try { context.IsFull(timer, context, emptyState, fullState, notDoneState); } catch (ArgumentException) { //bt.SendData("ErrorFullStateGoEmptyState"); writer.JsonWriterFunc("Emptystate", "0", "Fullstate error"); context.setState(emptyState); } catch (InvalidOperationException) { //bt.SendData("TimeoutGoEmptyState"); writer.JsonWriterFunc("Emptystate", "0", "Timeout"); context.setState(emptyState); } catch (Exception) { //bt.SendData("ErrorGoEmptyState"); writer.JsonWriterFunc("Emptystate", "0", "ProgramCrash"); context.setState(emptyState); } } void Init() { MagnetSensor Magnet = new MagnetSensor(); LaserSensorBottom LaserBot = new LaserSensorBottom(); LaserSensorTop LaserTop = new LaserSensorTop(); Magnet.Initiate(); LaserTop.Initiate(); LaserBot.Initiate(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RequestWindowFeature(WindowFeatures.NoTitle); Window.AddFlags(WindowManagerFlags.KeepScreenOn); mMagnetSensor = new MagnetSensor(this); mMagnetSensor.setOnCardboardTriggerListener(this); mNfcSensor = NfcSensor.getInstance(this); mNfcSensor.addOnCardboardNfcListener(this); OnNfcIntent(Intent); SetVolumeKeysMode(VolumeKeys.DISABLED_WHILE_IN_CARDBOARD); if (Build.VERSION.SdkInt < BuildVersionCodes.Kitkat) { var listener = new OnSystemUiVisibilityChangeListener(this); Window.DecorView.SetOnSystemUiVisibilityChangeListener(listener); } }