Guest User

PluginWrapper.cs

a guest
Dec 20th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class PluginWrapper : MonoBehaviour {
  6.  
  7.  
  8.     public void listen () {
  9.  
  10.         var plugin = new AndroidJavaClass ("com.example.unitymodule.PluginClass");
  11.  
  12.         plugin.CallStatic<bool> ("onCheckedListen", true);
  13.  
  14.         Response ();
  15.     }
  16.  
  17.     void Response(){
  18.         var plugin = new AndroidJavaClass ("com.example.unitymodule.PluginClass");
  19.         var result = plugin.CallStatic<string> ("returnRes");
  20.  
  21.         if (result == "jump") {
  22.  
  23.             transform.Translate (0f, 1.0f, 0f);
  24.  
  25.         } else if (result == "move left") {
  26.  
  27.             transform.Translate (-2.0f, 0f, 0f);
  28.  
  29.         } else if (result == "move right") {
  30.  
  31.             transform.Translate (2.0f, 0f, 0f);
  32.  
  33.         } else {
  34.             transform.Translate (2.0f, 0f, 2.0f);
  35.         }
  36.            
  37.  
  38.     }
  39.  
  40.  
  41.  
  42.  
  43.  
  44. }
Add Comment
Please, Sign In to add comment