コード例 #1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.UpArrow))
     {
         var pos = this.transform.position;
         pos.x += 1.0f;
         this.transform.position = pos;
     }
     else if (Input.GetKeyDown(KeyCode.DownArrow))
     {
         var pos = this.transform.position;
         pos.x -= 1.0f;
         this.transform.position = pos;
     }
     else if (Input.GetKeyDown(KeyCode.LeftArrow))
     {
         var pos = this.transform.position;
         pos.z += 1.0f;
         this.transform.position = pos;
     }
     else if (Input.GetKeyDown(KeyCode.RightArrow))
     {
         var pos = this.transform.position;
         pos.z -= 1.0f;
         this.transform.position = pos;
     }
     else if (Input.GetKeyDown(KeyCode.Space))
     {
         var pos  = this.transform.position;
         var data = new DatabaseAPI.UnfoldData()
         {
             x = Mathf.RoundToInt(pos.x), y = Mathf.RoundToInt(pos.z), creator = "Me!", piece_shape = "L"
         };
         DatabaseAPI.GetOrCreateInstance().SyncUnfold(data, d => Debug.Log(string.Format("Sending unfold at ({0}, {1})", data.x, data.y)), Debug.LogError);
     }
 }
コード例 #2
0
 private void Start()
 {
     DatabaseAPI.GetOrCreateInstance().ListenForUnfold(SpawnSphere, Debug.Log);
 }
コード例 #3
0
 private void OnDestroy()
 {
     DatabaseAPI.GetOrCreateInstance().StopListenForUnfold();
 }