| 1234567891011121314151617181920212223242526 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class BluetoothDispatcher : MonoBehaviour
- {
- public static System.Action<byte[]> aim;
- public static System.Action<byte[]> shoot;
- void Start()
- {
- BluetoothClient.onDataReceived = Dispatch;
- }
- void Dispatch(byte sign, byte[] data)
- {
- Debug.Log(sign + "---" + data);
- if (sign == 0 && aim != null)
- {
- aim(data);
- } else if (sign == 1 && shoot != null)
- {
- shoot(data);
- }
- }
- }
|