예제 #1
0
 void CheckTimer(object sender, ElapsedEventArgs e)
 {
     Device.BeginInvokeOnMainThread(async() =>
     {
         currentTime    -= 1;
         TimerLabel.Text = currentTime.ToString();
         if (currentTime <= App.panicTime)
         {
             TimerLabel.TextColor = Color.Red;
             try
             {
                 Vibration.Vibrate();
             }
             catch (FeatureNotSupportedException ex)
             {
                 // not supported
             }
         }
         if (currentTime == 0)
         {
             // this might have to be an await call
             try
             {
                 Vibration.Cancel();
             }
             catch (FeatureNotSupportedException ex)
             {
                 // not supported
             }
             timer.Enabled = false;
             await DisplayAlert("Time Up", "Time up yo", "OK");
             EndTurn();
         }
     });
 }
예제 #2
0
 void Update()
 {
     //control de diferentes inputs
     //Estructurado de esta manera en lugar de llamar a ProcessMouse directamente con ScreenInput.instance.getInput() porque
     //  lo primero que hace el método es calcular el centro más cercano, algo que no hace falta hacer en varios tipos de move
     if (ScreenInput.instance.getInput() == move.pressing)
     {
         ProcessMouse(move.pressing);
         click = true;       //auxiliar para ver la posición del ratón en onGizmosDraw
     }
     else
     {
         Vibration.Cancel();
         tapSound.Stop();
         click = false;
     }
     if (ScreenInput.instance.getInput() == move.click)
     {
         ProcessMouse(move.click);
     }
     else if (ScreenInput.instance.getInput() == move.doubleClick)
     {
         ProcessMouse(move.doubleClick);
     }
 }
예제 #3
0
    IEnumerator VibrateWithProximity()
    {
        if (proximity == 0f)
        {
            Vibration.Cancel();
        }
        if (proximity == 0.25f)
        {
            Vibration.VibratePop();
        }
        if (proximity == 0.5f)
        {
            Vibration.VibrateNope();
        }
        if (proximity == 0.75f)
        {
            Vibration.Vibrate();
        }
        if (proximity >= 1f)
        {
            Vibration.Vibrate(1000);
        }

        yield return(new WaitForSeconds(1));

        StartCoroutine(VibrateWithProximity());
    }
예제 #4
0
        public void EndTurn()
        {
            // Save the drawing to an Image array for later use
            try
            {
                Vibration.Cancel();
            }
            catch (FeatureNotSupportedException ex)
            {
                // Feature not supported on device
            }
            timer.Enabled = false;
            App.playerTimes.Add(App.drawTime - currentTime);
            SKBitmap bitmap = new SKBitmap((int)canvasView.CanvasSize.Width, (int)canvasView.CanvasSize.Height);
            SKCanvas canvas = new SKCanvas(bitmap);

            canvas.Clear(currentBGColour);
            foreach (SketchyPath path in completedPaths)
            {
                canvas.DrawPath(path.Path, path.Paint);
            }

            foreach (SketchyPath path in inProgressPaths.Values)
            {
                canvas.DrawPath(path.Path, path.Paint);
            }
            SKImage image = SKImage.FromBitmap(bitmap);

            App.playerDrawings.Add(image);
            // goto next screen
            Navigation.PushModalAsync(new PostTurnScreen());
        }
 private void StopButton_Clicked(object sender, EventArgs e)
 {
     stopPressed = true;
     Vibration.Cancel();
     stopButton.IsEnabled        = false;
     fallDetectedLabel.IsVisible = false;
 }
예제 #6
0
        private void vibrateButton_Clicked(object sender, EventArgs e)
        {
            if (vibrationOnBool == true)
            {
                Vibration.Cancel();
                vibrateButton.TextColor = Color.LightGray;
                vibrateButton.Text      = "Off   ";
                vibrationOnBool         = false;


                using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
                {
                    conn.CreateTable <WeekTraining> ();

                    conn.Execute("UPDATE WeekTraining SET VibrationOn= false WHERE MyWorkout=?", mWork);
                }
            }

            else if (vibrationOnBool == false)
            {
                vibrateButton.TextColor = Color.Green;
                vibrateButton.Text      = "On   ";
                vibrationOnBool         = true;

                using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
                {
                    conn.CreateTable <WeekTraining>();

                    conn.Execute("UPDATE WeekTraining SET VibrationOn= true WHERE MyWorkout=?", mWork);
                }
            }
        }
예제 #7
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(10, 10, 250, 50), "Vibrate();"))
        {
            Vibration.Vibrate();
        }

        if (GUI.Button(new Rect(10, 90, 250, 50), "Vibrate(2000);"))
        {
            Vibration.Vibrate(2000);
        }

        if (GUI.Button(new Rect(10, 170, 250, 50), "Vibrate(4000);"))
        {
            Vibration.Vibrate(4000);
        }

        if (GUI.Button(new Rect(10, 250, 250, 50), "Vibrate(8000);"))
        {
            Vibration.Vibrate(8000);
        }

        if (GUI.Button(new Rect(10, 330, 250, 50), "Cancel();"))
        {
            Vibration.Cancel();
        }
    }
예제 #8
0
    // Start is called before the first frame update
    void Start()
    {
        rendActive = false;
        Vibration.Cancel();

        for (int i = 0; i < objectsToActivate.Length; i++)
        {
            objectsToActivate[i].SetActive(false);
        }

        for (int i = 0; i < anims.Length; i++)
        {
            anims[i].enabled = false;
        }

        Vibration.Cancel();

        // reset fade of all renderers
        alphaVal = 0;

        for (int i = 0; i < spriteRends.Length; i++)
        {
            spriteRends[i].color = new Color(spriteRends[i].color.r, spriteRends[i].color.g, spriteRends[i].color.b, 0);
        }

        for (int i = 0; i < rends.Length; i++)
        {
            rends[i].material.color = new Color(rends[i].material.color.r, rends[i].material.color.g, rends[i].material.color.b, 0);
        }
    }
    private void VibraDeAcordoComAProximidadeDeGanhar()
    {
        Vibration.Cancel();

        if (parcialPlayer < 0.2f)
        {
            Vibration.Vibrate(new long[2] {
                40, 50
            }, 0);
        }
        else if (parcialPlayer < 0.4f)
        {
            Vibration.Vibrate(new long[2] {
                40, 45
            }, 0);
        }
        else if (parcialPlayer < 0.6f)
        {
            Vibration.Vibrate(new long[2] {
                40, 40
            }, 0);
        }
        else if (parcialPlayer < 0.8f)
        {
            Vibration.Vibrate(new long[2] {
                40, 35
            }, 0);
        }
        else
        {
            Vibration.Vibrate(new long[2] {
                40, 30
            }, 0);
        }
    }
예제 #10
0
    IEnumerator VibrationWait(long milliseconds)
    {
        Vibration.Vibrate(milliseconds);

        yield return(new WaitForSeconds(milliseconds * 0.001f));

        Vibration.Cancel();
    }
예제 #11
0
 void OnCollisionEnter2D(Collision2D coll)
 {
     if (coll.gameObject.tag == "Enemy")
     {
         Application.LoadLevel("gameover");
         Vibration.Cancel();
     }
 }
예제 #12
0
    private void Update()
    {
        if (Input.touchCount > 0)
        {
            var touch = Input.GetTouch(0);
            if (touch.phase == TouchPhase.Began)
            {
                _timeToMove = Time.deltaTime;

                //Debug.Log(_timeToMove);
            }
            else if (touch.phase == TouchPhase.Moved)
            {
                //Debug.Log(_timeToMove);
                if (_timeToMove < 0.08f)
                {
                    if (!_once)
                    {
                        _once = true;
                        _selectionManager.StartFlick();
                        //Debug.Log("swipe");
                    }
                    _selectionManager.FlickObjects();
                }
                else /*if (_timeToMove >= 0f)*/
                {
                    //if (!_once)
                    //{
                    //    _once = true;
                    //    //_selectionManager.SelectJewelleryPiece();
                    //    Debug.Log("drag drop");
                    //}
                    _selectionManager.MoveSelectedPiece();
                }
            }
            else if (touch.phase == TouchPhase.Stationary)
            {
                _timeToMove += Time.deltaTime;
                if (_timeToMove > 0.08f)
                {
                    if (!_once)
                    {
                        _once = true;
                        _selectionManager.SelectJewelleryPiece();
                        //Debug.Log("drag drop");
                    }
                }
                _selectionManager.MoveSelectedPiece();
            }
            else if (touch.phase == TouchPhase.Ended)
            {
                _selectionManager.DeselectPiece();
                _once = false;
                Vibration.Cancel();
                //particle.SetActive(false);
            }
        }
    }
예제 #13
0
 public static void stop()
 {
     if (isPlayingSomething())
     {
         Debug.Log("Stopping all patterns");
         Vibration.Cancel();
         turnAllOff();
     }
 }
예제 #14
0
 private void goToSelection()
 {
     Vibration.Cancel();             //se cancelan las vibraciones activas por si acaso
     formas[level].SetActive(false); //forma desactivada para que no siga activando vibraciones indeseadas
     selectionPhase = true;          //marcaje de bandera
     //ajustes del srm
     srm.type = SRType.Default;      //se cambia el modo de srm para que ahora sí reconozca los swipes
     srm.currentList.currentFocus = 0;
     srm.currentList.GoToBeginning();
 }
예제 #15
0
        private async void ExecuteCancelVibrate()
        {
            P1Stat = false;
            P2Stat = false;
            P3Stat = false;
            Vibration.Cancel();
            await SetCancellation();

            AllowRun = true;
        }
예제 #16
0
    }                                  //stops and resumes the vibrations when app unfocused

    private void Vibrate(bool vibrate) //stops and resumes the vibrations given a bool
    {
        if (!vibrate)
        {
            Vibration.Cancel();
        }
        if (vibrate)
        {
            UpdatePlayerInterface();
        }
    }
예제 #17
0
 // Update is called once per frame
 void Update()
 {
     click = Input.GetMouseButton(0);
     if (click)
     {
         checkClickPos();
     }
     else
     {
         Vibration.Cancel();
     }
 }
예제 #18
0
        public void CancelAlarm()
        {
            Ringtones ringtones = new Ringtones();

            ringtones.StopRingtone(alarm.SoundName);
            CancelVibration = true;
            Vibration.Cancel();
            alarm.Status = false;
            FileManager fileManager = new FileManager();

            fileManager.SaveAlarm(alarm);
            Navigation.PopAsync();
        }
예제 #19
0
 public async Task Pulse(int onDuty, int offDuty, TimeSpan totalDuration, CancellationToken token)
 {
     await Task.Factory.StartNew(() =>
     {
         var stopWatch = new Stopwatch();
         stopWatch.Start();
         while (stopWatch.Elapsed < totalDuration)
         {
             Vibration.Vibrate(onDuty);
             Task.Delay(offDuty).Wait();
         }
     }, token).ContinueWith((tsk) => Vibration.Cancel());
 }
예제 #20
0
 private void Update()
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         // Check if Back was pressed this frame
         if (Input.GetKeyDown(KeyCode.Escape))
         {
             // go back to the level select
             SceneManager.LoadScene(levelSelectScene);
             Vibration.Cancel();
         }
     } //back button condition in level
 }
예제 #21
0
 private void btn2_Clicked(object sender, EventArgs e)
 {
     try
     {
         Vibration.Cancel();
     }
     catch (FeatureNotSupportedException ex)
     {
     }
     catch (Exception ex)
     {
     }
 }
예제 #22
0
    // Update is called once per frame
    void Update()
    {
        timeLeft -= Time.deltaTime;
        if (timeLeft < 0)
        {
            Vibration.Cancel();
            Application.LoadLevel("SweetVictory");
        }
        int minutes = (int)timeLeft / 60;
        int seconds = (int)(timeLeft % 60);

        this.GetComponent <GUIText>().text = (minutes) + ":" + (seconds);
    }
예제 #23
0
 private void Button_Clicked(object sender, EventArgs e)
 {
     if (entry.Text == code)
     {
         Ringtones ringtones = new Ringtones();
         ringtones.StopRingtone(alarmPage.alarm.SoundName);
         alarmPage.CancelVibration = true;
         Vibration.Cancel();
         alarmPage.alarm.Status = false;
         FileManager fileManager = new FileManager();
         fileManager.SaveAlarm(alarmPage.alarm);
         CloseApp closeApp = new CloseApp();
     }
 }
 private void Vibrar_Clicked(object sender, EventArgs e)
 {
     try
     {
         Vibration.Cancel();
     }
     catch (FeatureNotSupportedException ex)
     {
         // Feature not supported on device
     }
     catch (Exception ex)
     {
         // Other error has occurred.
     }
 }
예제 #25
0
 private void VibrationCancel()
 {
     try
     {
         Vibration.Cancel();
     }
     catch (FeatureNotSupportedException ex)
     {
         // Feature not supported on device
     }
     catch (Exception ex)
     {
         // Other error has occurred.
     }
 }
예제 #26
0
 public void Stop()
 {
     try
     {
         Vibration.Cancel();
     }
     catch (FeatureNotSupportedException ex)
     {
         Console.WriteLine("Fonction non supportée" + ex);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Une Exception s'est produite" + ex);
     }
 }
예제 #27
0
    IEnumerator UpdateVibrator()
    {
        while (running_game)
        {
            if (minDist == 99)
            {
                vib.Cancel(); vibID_current = 44;
            }
            else
            {
                vibID = minDist >= 10 ? 5 : (int)(minDist / 2);

                if (vibID != vibID_current)
                {
                    vib.Cancel(); vib.Vibrate(vibID);
                }
                vibID_current = vibID;
                minDist       = 99;
            }

            yield return(new WaitForSeconds(.1f));
        }
        yield break;
    }
예제 #28
0
        void Update()
        {
            if (Input.touchCount == 1 && !hasTouched)
            {
                //Debug.Log(Vibration.HasVibrator());
                Vibration.Vibrate(pattern, 0);
                hasTouched = true;
            }

            if (Input.touchCount > 2 && hasTouched)
            {
                //Debug.Log(Vibration.HasVibrator());
                Vibration.Cancel();
                hasTouched = false;
            }
        }
예제 #29
0
 private void BtnVB_Off_Click(object sender, System.EventArgs e)
 {
     try
     {
         Vibration.Cancel();
         Toast.MakeText(this, $"Vibration - cancelled", ToastLength.Short).Show();
     }
     catch (FeatureNotSupportedException ex)
     {
         // Feature not supported on device
     }
     catch (Exception ex)
     {
         // Other error has occurred.
     }
 }
예제 #30
0
    private IEnumerator StartShake()
    {
        float   hitTime          = Time.time;
        Vector3 originalPosition = transform.localPosition;
        var     shake            = numberOfShake;
        float   shakeDistance    = startingShakeDistance;

        isShaking = true;
        while (shake > 0)
        {
            float timer = (Time.time - hitTime) * shakeSpeed;
            if (byRigidbody)
            {
                rigidbody.MovePosition(
                    new Vector3(
                        originalPosition.x + (float)((shakeType == ShakeType.OX || shakeType == ShakeType.BOTH) ? (Mathf.Sin(timer) * shakeDistance) : 0),
                        originalPosition.y + Mathf.Sin(timer) * .05f,
                        originalPosition.z + (float)((shakeType == ShakeType.OZ || shakeType == ShakeType.BOTH) ? (Mathf.Cos(timer) * shakeDistance) : 0))
                    );
            }
            else
            {
                transform.localPosition =
                    new Vector3(
                        originalPosition.x + (float)((shakeType == ShakeType.OX || shakeType == ShakeType.BOTH) ? (Mathf.Sin(timer) * shakeDistance) : 0),
                        originalPosition.y + Mathf.Sin(timer) * .05f,
                        originalPosition.z + (float)((shakeType == ShakeType.OZ || shakeType == ShakeType.BOTH) ? (Mathf.Cos(timer) * shakeDistance) : 0))
                ;
            }
            if (timer > Mathf.PI * 2)
            {
                hitTime        = Time.time;
                shakeDistance *= decreasePercentage;
                shake--;
            }
#if UNITY_ANDROID && !UNITY_EDITOR
            Vibration.Vibrate(10000);
#endif
            yield return(null);
        }
        #if UNITY_ANDROID && !UNITY_EDITOR
        Vibration.Cancel();
        #endif
        transform.localPosition = originalPosition;
        isShaking = false;
    }