示例#1
0
 void OnCollisionEnter2D()
 {
     if (!shield)
     {
         if (PlayerPrefs.GetInt("VBR") == 1)
         {
             AndroidNativeFunctions.Vibrate(500);
         }
         Debug.Log("we got hit");
         FindObjectOfType <AudioManager>().Play("collision");
         FindObjectOfType <GameManager>().EndGame();
         collisionTime = (int)Time.time;
     }
 }
    void Window2()
    {
        if (GUI.Button(NewRect(5, 5, 40, 10), "is Installed App", style))
        {
            print("is Installed App (Youtube): " + AndroidNativeFunctions.isInstalledApp("com.google.android.youtube"));
        }

        if (GUI.Button(NewRect(5, 20, 40, 10), "Open Google Play", style))
        {
            AndroidNativeFunctions.OpenGooglePlay("com.google.android.youtube");
        }

        if (GUI.Button(NewRect(5, 35, 40, 10), "is Rooted", style))
        {
            print("is Device Rooted: " + AndroidNativeFunctions.isDeviceRooted());
        }

        if (GUI.Button(NewRect(5, 50, 40, 10), "is TV Device", style))
        {
            print("is TV Device: " + AndroidNativeFunctions.isTVDevice());
        }

        if (GUI.Button(NewRect(5, 65, 40, 10), "is Wired Headset", style))
        {
            print("is Wired Headset: " + AndroidNativeFunctions.isWiredHeadset());
        }

        if (GUI.Button(NewRect(5, 80, 40, 10), "<<", style))
        {
            window = 1;
        }

        if (GUI.Button(NewRect(55, 5, 40, 10), "Has Vibrate", style))
        {
            print("Has Vibrate: " + AndroidNativeFunctions.hasVibrator());
        }

        if (GUI.Button(NewRect(55, 20, 40, 10), "Vibrate 3 sec", style))
        {
            AndroidNativeFunctions.Vibrate(3000);
        }

        if (GUI.Button(NewRect(55, 35, 40, 10), "Vibrate with pattern", style))
        {
            AndroidNativeFunctions.Vibrate(new long[] { 0, 100, 200, 300, 400 }, -1);
        }

        if (GUI.Button(NewRect(55, 50, 40, 10), "Vibrate with pattern (loop)", style))
        {
            AndroidNativeFunctions.Vibrate(new long[] { 0, 100, 200, 300, 400 }, 0);
        }

        if (GUI.Button(NewRect(55, 65, 40, 10), "Vibrate Cancel", style))
        {
            AndroidNativeFunctions.VibrateCancel();
        }

        if (GUI.Button(NewRect(55, 80, 40, 10), ">>", style))
        {
            window = 3;
        }
    }