Exemple #1
0
    public override float Notify(float distance, float rotation)
    {
        //stop any previous vibrations
        StopAllCoroutines();

        //player facing straight
        if (Mathf.Abs(rotation) < 10)
        {
            Vibrate_Watch.VIBRATE_LEFT(3, 128, 256);
            Vibrate_Watch.VIBRATE_RIGHT(3, 128, 256);
            StartCoroutine("Vibrate", vibes[0]);
        }
        else
        {
            if (rotation < 0)
            {
                rotation = -rotation;
                if (rotation < 45)
                {
                    Vibrate_Watch.VIBRATE_RIGHT(3, 128, 256);
                }
                else if (rotation < 90)
                {
                    Vibrate_Watch.VIBRATE_RIGHT(2, 128, 256);
                }
                else
                {
                    Vibrate_Watch.VIBRATE_RIGHT(1, 128, 256);
                }
            }
            else
            {
                if (rotation < 45)
                {
                    Vibrate_Watch.VIBRATE_LEFT(3, 128, 256);
                }
                else if (rotation < 90)
                {
                    Vibrate_Watch.VIBRATE_LEFT(2, 128, 256);
                }
                else
                {
                    Vibrate_Watch.VIBRATE_LEFT(1, 128, 256);
                }
            }
        }


        //return how long to wait until next notification
        return(3);
    }
 public Text text_status;    //show the status on screen in top rights
 // Use this for initialization
 void Start()
 {
     text_status.text = "";
     instance         = this;
 }