Browse Source

删除了安卓BLE插件

master
DESKTOP-B25GA9E\W35 2 years ago
parent
commit
b15b1dce0c
  1. 10
      Assets/Plugins/Android.meta
  2. BIN
      Assets/Plugins/Android/BTPluginAndroid.aar
  3. 32
      Assets/Plugins/Android/BTPluginAndroid.aar.meta
  4. 267
      Assets/Plugins/BluetoothForAndroid.cs
  5. 13
      Assets/Plugins/BluetoothForAndroid.cs.meta
  6. 8
      Assets/Simple Bluetooth for android.meta
  7. 10
      Assets/Simple Bluetooth for android/Demos.meta
  8. 10
      Assets/Simple Bluetooth for android/Demos/Game Example.meta
  9. 10
      Assets/Simple Bluetooth for android/Demos/Game Example/Animations.meta
  10. 175
      Assets/Simple Bluetooth for android/Demos/Game Example/Animations/WaitAnimation.anim
  11. 10
      Assets/Simple Bluetooth for android/Demos/Game Example/Animations/WaitAnimation.anim.meta
  12. 69
      Assets/Simple Bluetooth for android/Demos/Game Example/Animations/WaitImage.controller
  13. 10
      Assets/Simple Bluetooth for android/Demos/Game Example/Animations/WaitImage.controller.meta
  14. 10
      Assets/Simple Bluetooth for android/Demos/Game Example/Prefabs.meta
  15. 223
      Assets/Simple Bluetooth for android/Demos/Game Example/Prefabs/Bullet.prefab
  16. 10
      Assets/Simple Bluetooth for android/Demos/Game Example/Prefabs/Bullet.prefab.meta
  17. 10
      Assets/Simple Bluetooth for android/Demos/Game Example/Scenes.meta
  18. 2730
      Assets/Simple Bluetooth for android/Demos/Game Example/Scenes/GameScene.unity
  19. 9
      Assets/Simple Bluetooth for android/Demos/Game Example/Scenes/GameScene.unity.meta
  20. 2253
      Assets/Simple Bluetooth for android/Demos/Game Example/Scenes/Menu.unity
  21. 9
      Assets/Simple Bluetooth for android/Demos/Game Example/Scenes/Menu.unity.meta
  22. 10
      Assets/Simple Bluetooth for android/Demos/Game Example/Scripts.meta
  23. 16
      Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/BulletScript.cs
  24. 13
      Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/BulletScript.cs.meta
  25. 212
      Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/GameScene.cs
  26. 13
      Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/GameScene.cs.meta
  27. 89
      Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/MenuInterface.cs
  28. 13
      Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/MenuInterface.cs.meta
  29. 74
      Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/NetworkManager.cs
  30. 13
      Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/NetworkManager.cs.meta
  31. 10
      Assets/Simple Bluetooth for android/Demos/Game Example/Sprites.meta
  32. BIN
      Assets/Simple Bluetooth for android/Demos/Game Example/Sprites/square.png
  33. 92
      Assets/Simple Bluetooth for android/Demos/Game Example/Sprites/square.png.meta
  34. BIN
      Assets/Simple Bluetooth for android/Demos/Game Example/Sprites/whiteCircle.png
  35. 92
      Assets/Simple Bluetooth for android/Demos/Game Example/Sprites/whiteCircle.png.meta
  36. 10
      Assets/Simple Bluetooth for android/Demos/Usage Example.meta
  37. 10
      Assets/Simple Bluetooth for android/Demos/Usage Example/Scenes.meta
  38. 3687
      Assets/Simple Bluetooth for android/Demos/Usage Example/Scenes/Main.unity
  39. 9
      Assets/Simple Bluetooth for android/Demos/Usage Example/Scenes/Main.unity.meta
  40. 10
      Assets/Simple Bluetooth for android/Demos/Usage Example/Scripts.meta
  41. 168
      Assets/Simple Bluetooth for android/Demos/Usage Example/Scripts/Interface.cs
  42. 13
      Assets/Simple Bluetooth for android/Demos/Usage Example/Scripts/Interface.cs.meta
  43. 10
      Assets/Simple Bluetooth for android/Documentation.meta
  44. BIN
      Assets/Simple Bluetooth for android/Documentation/Documentation.pdf
  45. 9
      Assets/Simple Bluetooth for android/Documentation/Documentation.pdf.meta
  46. BIN
      Assets/Simple Bluetooth for android/Documentation/Readme.pdf
  47. 9
      Assets/Simple Bluetooth for android/Documentation/Readme.pdf.meta

10
Assets/Plugins/Android.meta

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 562ae2df5aa68b641acd8208d36802d4
folderAsset: yes
timeCreated: 1547402850
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Plugins/Android/BTPluginAndroid.aar

Binary file not shown.

32
Assets/Plugins/Android/BTPluginAndroid.aar.meta

@ -1,32 +0,0 @@ @@ -1,32 +0,0 @@
fileFormatVersion: 2
guid: dbd87312a872da045b50fc427851aa45
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

267
Assets/Plugins/BluetoothForAndroid.cs

@ -1,267 +0,0 @@ @@ -1,267 +0,0 @@
using System;
using System.Text;
using UnityEngine;
// ATTENTION !!!
// This is the service class of the plugin for working with the native code of the android system.
// No need to change anything here, otherwise the plugin will stop working.
// To work with plug-in methods, read Documentation.pdf
namespace SVSBluetooth {
public class BluetoothForAndroid {
private static BluetoothForAndroid instance;
public static AndroidJavaClass javaClass;
public static AndroidJavaObject javaObject;
public static event Action BtAdapterEnabled;
public static event Action BtAdapterDisabled;
public static event Action ServerStarted;
public static event Action ServerStopped;
public static event Action AttemptConnectToServer;
public static event Action FailConnectToServer;
public static event Action DeviceConnected;
public static event Action DeviceDisconnected;
public static event Action<int> ReceivedIntMessage;
public static event Action<float> ReceivedFloatMessage;
public static event Action<string> ReceivedStringMessage;
public static event Action<byte[]> ReceivedByteMessage;
public static event Action<string> DeviceSelected;
const string BT_CLASS_NAME = "com.SVStar.BtForUnityAndroid.BT_Plugin";
public struct BTDevice {
public string name;
public string address;
public BTDevice(string name, string address) {
this.name = name;
this.address = address;
}
}
#region static methods
public static void Initialize() {
if (Application.platform == RuntimePlatform.Android) {
if (instance == null) instance = new BluetoothForAndroid();
GameObject emptyObject = new GameObject();
emptyObject.AddComponent<BluetoothBridgeForAndroid>();
javaClass = new AndroidJavaClass(BT_CLASS_NAME);
javaClass.CallStatic("Initialize");
javaObject = javaClass.GetStatic<AndroidJavaObject>("btPlugin");
}
}
public static bool IsBTEnabled() {
if (javaObject != null) return javaObject.Call<bool>("IsEnabled");
else return false;
}
public static void EnableBT() {
if (javaObject != null) javaObject.Call("EnableBT");
}
public static void DisableBT() {
if (javaObject != null) javaObject.Call("DisableBT");
}
public static void CreateServer(string UUID) {
if (javaObject != null) {
javaObject.Call("CreateServer", UUID);
}
}
public static void StopServer() {
if (javaObject != null) {
javaObject.Call("StopServer");
}
}
public static void ConnectToServer(string UUID) {
if (javaObject != null) {
javaObject.Call("ConnectToServer", UUID);
}
}
public static void Disconnect() {
if (javaObject != null) javaObject.Call("Disconnect");
}
public static void WriteMessage(int val) {
if (javaObject != null) {
byte[] array = BitConverter.GetBytes(val);
javaObject.Call("WriteMessage", instance.ModAddArray(array, 0));
}
}
public static void WriteMessage(float val) {
if (javaObject != null) {
byte[] array = BitConverter.GetBytes(val);
javaObject.Call("WriteMessage", instance.ModAddArray(array, 1));
}
}
public static void WriteMessage(string val) {
if (javaObject != null && val.Length > 0) {
byte[] array = Encoding.UTF8.GetBytes(val);
javaObject.Call("WriteMessage", instance.ModAddArray(array, 2));
}
}
public static void WriteMessage(byte[] val) {
if (javaObject != null && val.Length > 0) {
javaObject.Call("WriteMessage", instance.ModAddArray(val, 3));
}
}
public static BTDevice[] GetBondedDevices() {
if (javaObject != null) {
return instance.GetBTArray(javaObject.Call<string[]>("GetBondedDevices"));
}
else return null;
}
public static void ConnectToServerByAddress(string UUID, string address) {
string[] par = { UUID, address };
if (javaObject != null) javaObject.Call("ConnectToServerByAddress", par);
}
#endregion
#region SERVICE METHODS PLUGIN
public void GetInputData() {
if (javaObject != null) {
byte[] array = javaObject.Call<byte[]>("GetInputData");
ConvertFromByte(array);
}
}
private void ConvertFromByte(byte[] array) {
if (array != null) {
switch (array[0]) {
case 0:
if (ReceivedIntMessage != null) ReceivedIntMessage(BitConverter.ToInt32(array, 1));
break;
case 1:
if (ReceivedFloatMessage != null) ReceivedFloatMessage(BitConverter.ToSingle(array, 1));
break;
case 2:
if (ReceivedStringMessage != null) ReceivedStringMessage(Encoding.UTF8.GetString(ModRemoveArray(array)));
break;
case 3:
if (ReceivedByteMessage != null) ReceivedByteMessage(ModRemoveArray(array));
break;
}
}
else Debug.Log("blue = ArrayNull");
}
private byte[] ModAddArray(byte[] array, int typeData) {
byte[] lengthArray = BitConverter.GetBytes(array.Length + 1);
byte[] newArray = new byte[array.Length + 5];
newArray[0] = lengthArray[3];
newArray[1] = lengthArray[2];
newArray[2] = lengthArray[1];
newArray[3] = lengthArray[0];
newArray[4] = (byte)typeData;
for (int i = 0; i < array.Length; i++) {
newArray[i + 5] = array[i];
}
return newArray;
}
private byte[] ModRemoveArray(byte[] array) {
byte[] newArray = new byte[array.Length - 1];
for (int i = 0; i < array.Length - 1; i++) {
newArray[i] = array[i + 1];
}
return newArray;
}
public void OnBtAdapterEnabled() {
if (BtAdapterEnabled != null) BtAdapterEnabled();
}
public void OnBtAdapterDisabled() {
if (BtAdapterDisabled != null) BtAdapterDisabled();
}
public void OnServerStarted() {
if (ServerStarted != null) ServerStarted();
}
public void OnServerStopped() {
if (ServerStopped != null) ServerStopped();
}
public void OnAttemptConnectToServer() {
if (AttemptConnectToServer != null) AttemptConnectToServer();
}
public void OnFailConnectToServer() {
if (FailConnectToServer != null) FailConnectToServer();
}
public void OnDeviceConnected() {
if (DeviceConnected != null) DeviceConnected();
}
public void OnDeviceDisconnected() {
if (DeviceDisconnected != null) DeviceDisconnected();
}
public void OnDeviceSelected(string deviceData) {
if (DeviceSelected != null) DeviceSelected(deviceData);
}
private BTDevice[] GetBTArray(string[] devices) {
BTDevice[] btDevices = new BTDevice[devices.Length / 2];
int j = 0;
for (int i = 0; i < devices.Length; i = i + 2) {
btDevices[j].name = devices[i];
btDevices[j].address = devices[i + 1];
j++;
}
return btDevices;
}
#endregion
public class BluetoothBridgeForAndroid : MonoBehaviour {
private BluetoothForAndroid btForUnity;
void Start() {
btForUnity = instance;
DontDestroyOnLoad(gameObject);
gameObject.name = "BluetoothForAndroid";
}
public void NewInputData(string message) {
btForUnity.GetInputData();
}
public void BtAdapterEnabled(string message) {
btForUnity.OnBtAdapterEnabled();
}
public void BtAdapterDisabled(string message) {
btForUnity.OnBtAdapterDisabled();
}
public void ServerStarted(string message) {
btForUnity.OnServerStarted();
}
public void ServerStopped(string message) {
btForUnity.OnServerStopped();
}
public void AttemptConnectToServer(string message) {
btForUnity.OnAttemptConnectToServer();
}
public void FailConnectToServer(string message) {
btForUnity.OnFailConnectToServer();
}
public void DeviceConnected(string message) {
btForUnity.OnDeviceConnected();
}
public void DeviceDisconnected(string message) {
btForUnity.OnDeviceDisconnected();
}
public void DeviceSelected(string message) {
btForUnity.OnDeviceSelected(message);
}
}
}
}

13
Assets/Plugins/BluetoothForAndroid.cs.meta

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 267e70df40fb892429d297a54b396f1c
timeCreated: 1550671012
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Simple Bluetooth for android.meta

@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 13d908fcfd3852f4889f2603952c8225
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

10
Assets/Simple Bluetooth for android/Demos.meta

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 871d74fd920b4fd41a62f630c2226666
folderAsset: yes
timeCreated: 1551017142
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

10
Assets/Simple Bluetooth for android/Demos/Game Example.meta

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 8822f12ccef60ba4b95f9a17177a0ce6
folderAsset: yes
timeCreated: 1551017206
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

10
Assets/Simple Bluetooth for android/Demos/Game Example/Animations.meta

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 690d80996b29d2d4a9090326560d1007
folderAsset: yes
timeCreated: 1551017322
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

175
Assets/Simple Bluetooth for android/Demos/Game Example/Animations/WaitAnimation.anim

@ -1,175 +0,0 @@ @@ -1,175 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: WaitAnimation
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 2
time: 0
value: {x: 0, y: 0, z: 0}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: -120}
tangentMode: 0
- serializedVersion: 2
time: 3
value: {x: 0, y: 0, z: -360}
inSlope: {x: 0, y: 0, z: -120}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
path:
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves: []
m_SampleRate: 20
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 4
script: {fileID: 0}
typeID: 4
customType: 14
isPPtrCurve: 0
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 3
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 2
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
- serializedVersion: 2
time: 3
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: localEulerAnglesRaw.x
path:
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 2
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
- serializedVersion: 2
time: 3
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: localEulerAnglesRaw.y
path:
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 2
time: 0
value: 0
inSlope: 0
outSlope: -120
tangentMode: 69
- serializedVersion: 2
time: 3
value: -360
inSlope: -120
outSlope: 0
tangentMode: 69
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: localEulerAnglesRaw.z
path:
classID: 224
script: {fileID: 0}
m_EulerEditorCurves:
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.x
path:
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.y
path:
classID: 224
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.z
path:
classID: 224
script: {fileID: 0}
m_HasGenericRootTransform: 1
m_HasMotionFloatCurves: 0
m_GenerateMotionCurves: 0
m_Events: []

10
Assets/Simple Bluetooth for android/Demos/Game Example/Animations/WaitAnimation.anim.meta

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: be683776d58553048bd53424077f9efa
timeCreated: 1550165306
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

69
Assets/Simple Bluetooth for android/Demos/Game Example/Animations/WaitImage.controller

@ -1,69 +0,0 @@ @@ -1,69 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: WaitImage
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: 1107245597049827450}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1102 &1102881616539336170
AnimatorState:
serializedVersion: 5
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: WaitAnimation
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: be683776d58553048bd53424077f9efa, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1107 &1107245597049827450
AnimatorStateMachine:
serializedVersion: 5
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 1102881616539336170}
m_Position: {x: 200, y: 0, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 1102881616539336170}

10
Assets/Simple Bluetooth for android/Demos/Game Example/Animations/WaitImage.controller.meta

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: c76440f0af9f2bc43902dff031718eaa
timeCreated: 1550165306
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

10
Assets/Simple Bluetooth for android/Demos/Game Example/Prefabs.meta

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 4433e6c45baa1e3469afe12339858b28
folderAsset: yes
timeCreated: 1551017322
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

223
Assets/Simple Bluetooth for android/Demos/Game Example/Prefabs/Bullet.prefab

@ -1,223 +0,0 @@ @@ -1,223 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1739251397563562}
m_IsPrefabParent: 1
--- !u!1 &1739251397563562
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4751556619128430}
- component: {fileID: 212768017619414698}
- component: {fileID: 96584280816311856}
- component: {fileID: 58722140026390992}
- component: {fileID: 50262360424858344}
- component: {fileID: 114751412628715058}
m_Layer: 0
m_Name: Bullet
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4751556619128430
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1739251397563562}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!50 &50262360424858344
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1739251397563562}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 0.1
m_LinearDrag: 0
m_AngularDrag: 0
m_GravityScale: 0
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 1
m_Constraints: 0
--- !u!58 &58722140026390992
CircleCollider2D:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1739251397563562}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 0.1
--- !u!96 &96584280816311856
TrailRenderer:
serializedVersion: 2
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1739251397563562}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 0
m_DynamicOccludee: 0
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_Materials:
- {fileID: 10301, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Time: 0.2
m_Parameters:
serializedVersion: 2
widthMultiplier: 0.2
widthCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 2
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
colorGradient:
serializedVersion: 2
key0: {r: 1, g: 0.6827586, b: 0, a: 1}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 2
m_NumAlphaKeys: 2
numCornerVertices: 0
numCapVertices: 0
alignment: 0
textureMode: 0
generateLightingData: 0
m_MinVertexDistance: 0.1
m_Autodestruct: 0
--- !u!114 &114751412628715058
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1739251397563562}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6d70cde032d2b5347a2a1beab4c8c06d, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!212 &212768017619414698
SpriteRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1739251397563562}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 10
m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0}
m_Color: {r: 1, g: 0.6827586, b: 0, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.2, y: 0.2}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0

10
Assets/Simple Bluetooth for android/Demos/Game Example/Prefabs/Bullet.prefab.meta

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: c128f36eda4396344bea624e4fe3d50f
timeCreated: 1550235053
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

10
Assets/Simple Bluetooth for android/Demos/Game Example/Scenes.meta

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 23763c8109c2b8e438cf124f9c908cd2
folderAsset: yes
timeCreated: 1551017322
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

2730
Assets/Simple Bluetooth for android/Demos/Game Example/Scenes/GameScene.unity

File diff suppressed because it is too large Load Diff

9
Assets/Simple Bluetooth for android/Demos/Game Example/Scenes/GameScene.unity.meta

@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: da92ce338e5af734190a1fda4eb1e420
timeCreated: 1550234839
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

2253
Assets/Simple Bluetooth for android/Demos/Game Example/Scenes/Menu.unity

File diff suppressed because it is too large Load Diff

9
Assets/Simple Bluetooth for android/Demos/Game Example/Scenes/Menu.unity.meta

@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: ccbfacc2b8e94c14993b4b8ee3bd42dd
timeCreated: 1547393127
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

10
Assets/Simple Bluetooth for android/Demos/Game Example/Scripts.meta

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: a7cda8670d0ccd145abf293fb28296fc
folderAsset: yes
timeCreated: 1551017322
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

16
Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/BulletScript.cs

@ -1,16 +0,0 @@ @@ -1,16 +0,0 @@
using UnityEngine;
public class BulletScript : MonoBehaviour {
// collision check. If the projectile collides with a wall or with its own tank, then it is simply destroyed.
// If the projectile collides with an enemy tank, then it is destroyed and calls the method of reducing HP in the GameScene script.
private void OnCollisionEnter2D(Collision2D collision) {
if (collision.gameObject.name == "LeftBorder" || collision.gameObject.name == "RightBorder" || collision.gameObject.name == "PlayerTank") {
Destroy(gameObject);
}
else {
GameScene.instance.HitByEnemy();
Destroy(gameObject);
}
}
}

13
Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/BulletScript.cs.meta

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 6d70cde032d2b5347a2a1beab4c8c06d
timeCreated: 1550409650
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 400
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

212
Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/GameScene.cs

@ -1,212 +0,0 @@ @@ -1,212 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class GameScene : MonoBehaviour {
public static GameScene instance;
// Objects
public GameObject tankPlayer;
public GameObject tankEnemy;
public GameObject bullet;
// Text fields
public Text playerHealthText;
public Text enemyHealthText;
public Text scoreText;
// Game variables
int playerHealth = 100;
int enemyHealth = 100;
int playerDeath;
int enemyDeath;
// Input
bool goUp;
bool goDown;
// Fields for interpolating the movement of an enemy
Queue<Vector2> posEnemyBuffer = new Queue<Vector2>();
bool bufferReady;
int frame;
int stepToNewPoint;
Vector2 step;
void Start() {
Application.targetFrameRate = 30;
if (instance == null) instance = this; // creating singleton
UpdateVievHealth();
UpdateScore();
float timeRepeat = 1f / 30f;
InvokeRepeating("MovePlayer", 0f, timeRepeat);
InvokeRepeating("MoveEnemy", timeRepeat, timeRepeat);
InvokeRepeating("SendPosition", timeRepeat, timeRepeat);
}
////////////////////////
// Methods for the tank of this device
////////////////////////
// player tank movement when pushing buttons
void MovePlayer() {
if (playerHealth > 0) {
if (goUp || goDown) {
int direction = goUp ? 1 : -1;
Vector2 vector = tankPlayer.transform.position;
vector.y = Mathf.Clamp(vector.y + 10 * Time.deltaTime * direction, -2.8f, 2.8f);
tankPlayer.transform.position = vector;
}
}
}
// wrapping a player’s tank position into an array of bytes and transferring this array to an enemy device
void SendPosition() {
byte[] position = new byte[9];
byte[] posX = new byte[4];
byte[] posY = new byte[4];
posX = NetworkManager.instance.FloatToBytes(tankPlayer.transform.position.x);
posY = NetworkManager.instance.FloatToBytes(tankPlayer.transform.position.y);
position[0] = 0;
position[1] = posX[0];
position[2] = posX[1];
position[3] = posX[2];
position[4] = posX[3];
position[5] = posY[0];
position[6] = posY[1];
position[7] = posY[2];
position[8] = posY[3];
NetworkManager.instance.WriteMessage(position); // message transfer
}
// delay between shots
IEnumerator ShotPlayer() {
while (true) {
if (playerHealth > 0) {
Vector2 vector = tankPlayer.transform.position;
vector.x += 1;
GameObject newBullet = Instantiate(bullet, vector, Quaternion.identity);
newBullet.GetComponent<Rigidbody2D>().AddForce(Vector2.right * 100);
NetworkManager.instance.WriteMessage(new byte[1] { (byte)1 }); // message transfer
}
yield return new WaitForSeconds(0.3f);
}
}
// the reduction of the HP of the enemy tank and the destruction of the tank when the HP is equal to zero
public void HitByEnemy() {
if (enemyHealth > 20) {
enemyHealth -= 20;
NetworkManager.instance.WriteMessage(new byte[2] { (byte)2, (byte)enemyHealth }); // message transfer
UpdateVievHealth();
}
else if (enemyHealth == 20) {
enemyHealth = 0;
NetworkManager.instance.WriteMessage(new byte[1] { (byte)3 }); // message transfer
UpdateVievHealth();
tankEnemy.transform.position = new Vector2(3.256f, 20);
Invoke("ReturnEnemyToStartingPosion", 1f);
enemyDeath++;
UpdateScore();
}
}
// the return of the enemy’s tank to the starting position a second after its destruction
void ReturnEnemyToStartingPosion() {
tankEnemy.transform.position = new Vector2(3.256f, 0);
enemyHealth = 100;
NetworkManager.instance.WriteMessage(new byte[1] { (byte)4 }); // message transfer
posEnemyBuffer.Clear();
UpdateVievHealth();
}
/////////////////////////////
// Commands from another device
/////////////////////////////
// If the buffer is not empty, then the movement of the enemy tank begins.
// tank movement
void MoveEnemy() {
if (enemyHealth > 0) {
if (posEnemyBuffer.Count > 0) tankEnemy.transform.position = posEnemyBuffer.Dequeue();
}
}
// The resulting positions are converted from an array of bytes to coordinates of type Vector2 and added to the buffer.
public void PutInBufferPosition(byte[] position) {
Vector2 currentPosition;
byte[] posX = new byte[4];
byte[] posY = new byte[4];
posX[0] = position[1];
posX[1] = position[2];
posX[2] = position[3];
posX[3] = position[4];
posY[0] = position[5];
posY[1] = position[6];
posY[2] = position[7];
posY[3] = position[8];
currentPosition.x = -NetworkManager.instance.BytesToFloat(posX);
currentPosition.y = NetworkManager.instance.BytesToFloat(posY);
posEnemyBuffer.Enqueue(currentPosition);
}
// shot of an enemy tank
public void ShotEnemy() {
Vector2 vector = tankEnemy.transform.position;
vector.x -= 1;
GameObject newBullet = Instantiate(bullet, vector, Quaternion.identity);
newBullet.GetComponent<Rigidbody2D>().AddForce(-Vector2.right * 100);
}
// hitting the player's tank
public void HitByPlayer(byte health) {
playerHealth = (int)health;
UpdateVievHealth();
}
// player tank destruction
public void DestroyTankPlayer() {
tankPlayer.transform.position = new Vector2(-3.256f, 20);
playerHealth = 0;
playerDeath++;
UpdateVievHealth();
UpdateScore();
}
// the return of the player’s tank to the starting position
public void ReturnPlayerToStartingPosion() {
tankPlayer.transform.position = new Vector2(-3.256f, 0);
frame = 0;
playerHealth = 100;
UpdateVievHealth();
}
// View
void UpdateVievHealth() {
playerHealthText.text = playerHealth + "%";
enemyHealthText.text = enemyHealth + "%";
}
void UpdateScore() {
scoreText.text = playerDeath + ":" + enemyDeath;
}
// Input
public void UpButtonPointerDown() {
goUp = true;
}
public void UpButtonPointerUp() {
goUp = false;
}
public void DownButtonPointerDown() {
goDown = true;
}
public void DownButtonPointerUp() {
goDown = false;
}
public void ShotButtonPointerDown() {
StartCoroutine("ShotPlayer");
}
public void ShotButtonPointerUp() {
StopCoroutine("ShotPlayer");
}
public void ExitScene() {
NetworkManager.instance.ExitGameScene();
}
}

13
Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/GameScene.cs.meta

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 7555efb48b9f1cf45948201f900bcfed
timeCreated: 1550409650
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 390
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

89
Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/MenuInterface.cs

@ -1,89 +0,0 @@ @@ -1,89 +0,0 @@
using UnityEngine;
using UnityEngine.SceneManagement;
using SVSBluetooth;
public class MenuInterface : MonoBehaviour {
public string MY_UUID; // UUID string that is set through the inspector
string role;
public GameObject MultiplayerPanel;
public GameObject WaitPanel;
public GameObject turnOnBluetoothText;
public GameObject failConnectionText;
public GameObject waitConnectionImage;
public GameObject waitConnectionCancelButton;
// comments for operations of the same type will not be repeated
// event subscription
// for information on the appointment of events, see the Documentation.pdf
private void OnEnable() {
BluetoothForAndroid.BtAdapterEnabled += HideTurnOnBluetoothText;
BluetoothForAndroid.DeviceConnected += LoadGameScene;
BluetoothForAndroid.ServerStarted += OpenWaitConnectionWindow;
BluetoothForAndroid.AttemptConnectToServer += OpenWaitConnectionWindow;
BluetoothForAndroid.FailConnectToServer += FailConnect;
}
// unsubscribe from events
private void OnDisable() {
BluetoothForAndroid.BtAdapterEnabled -= HideTurnOnBluetoothText;
BluetoothForAndroid.DeviceConnected -= LoadGameScene;
BluetoothForAndroid.ServerStarted -= OpenWaitConnectionWindow;
BluetoothForAndroid.AttemptConnectToServer -= OpenWaitConnectionWindow;
BluetoothForAndroid.FailConnectToServer -= FailConnect;
}
private void Start() {
Screen.sleepTimeout = SleepTimeout.NeverSleep; // so that the screen does not go out
BluetoothForAndroid.Initialize(); // plugin initialization
}
public void ExitGame() {
Application.Quit(); // close application
}
public void OpenMultiplayerWindow() {
if (!BluetoothForAndroid.IsBTEnabled()) BluetoothForAndroid.EnableBT(); // command to turn on the bluetooth if the bluetooth adapter is not activated
MultiplayerPanel.SetActive(true); // opening the connection window
}
public void CloseMultiplayerWindow() {
MultiplayerPanel.SetActive(false);// close the connection window
}
public void StarServer() {
role = "server"; // a flag that activates or deactivates the cancel button on the connection standby screen
if (BluetoothForAndroid.IsBTEnabled()) {
turnOnBluetoothText.SetActive(false);
BluetoothForAndroid.CreateServer(MY_UUID); // create a server with the specified UUID
}
else turnOnBluetoothText.SetActive(true); // if bluetooth is off, a message is displayed asking you to turn on bluetooth
}
public void ConnectToServer() {
role = "client";
if (BluetoothForAndroid.IsBTEnabled()) {
turnOnBluetoothText.SetActive(false);
BluetoothForAndroid.ConnectToServer(MY_UUID); // connect to server with specified UUID
}
else turnOnBluetoothText.SetActive(true);
}
private void HideTurnOnBluetoothText() {
turnOnBluetoothText.SetActive(false);
}
private void OpenWaitConnectionWindow() {
waitConnectionImage.SetActive(true); // turning on animation
WaitPanel.SetActive(true);
failConnectionText.SetActive(false);
if (role == "server") waitConnectionCancelButton.SetActive(true);
else waitConnectionCancelButton.SetActive(false);
}
private void FailConnect() {
waitConnectionImage.SetActive(false);
waitConnectionCancelButton.SetActive(true);
failConnectionText.SetActive(true);
}
public void CloseWaitConnectionWindow() {
if (role == "server") BluetoothForAndroid.StopServer(); // server shutdown
WaitPanel.SetActive(false);
}
void LoadGameScene() {
SceneManager.LoadScene(1); // loading the game scene
}
}

13
Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/MenuInterface.cs.meta

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 46e8fbd6d835f98428d28f4819475bfa
timeCreated: 1550409650
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 350
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

74
Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/NetworkManager.cs

@ -1,74 +0,0 @@ @@ -1,74 +0,0 @@
using System;
using UnityEngine;
using UnityEngine.SceneManagement;
using SVSBluetooth;
// this script serves as a bridge between the game script and the bluetooth plugin
public class NetworkManager : MonoBehaviour {
public static NetworkManager instance; // singleton
// subscription and unsubscribe to events
private void OnEnable() {
BluetoothForAndroid.DeviceDisconnected += ExitGameScene;
BluetoothForAndroid.ReceivedByteMessage += GetMessage;
}
private void OnDisable() {
BluetoothForAndroid.DeviceDisconnected -= ExitGameScene;
BluetoothForAndroid.ReceivedByteMessage -= GetMessage;
}
void Start() {
if (instance == null) instance = this; // creating singleton
}
// data transfer protocol
// you can come up with any protocol
// message[0] == 0 - change position
// message[0] == 1 - shot
// message[0] == 2 - hit
// message[0] == 3 - destroy tank
// message[0] == 4 - return to starting posion
// when a message is received, methods from the GameScene script are called
// Information about which method to call is contained in the first byte of the array
void GetMessage(byte[] message) {
switch ((int)message[0]) {
case 0:
GameScene.instance.PutInBufferPosition(message);
break;
case 1:
GameScene.instance.ShotEnemy();
break;
case 2:
GameScene.instance.HitByPlayer(message[1]);
break;
case 3:
GameScene.instance.DestroyTankPlayer();
break;
case 4:
GameScene.instance.ReturnPlayerToStartingPosion();
break;
default:
break;
}
}
// message transfer
public void WriteMessage(byte[] message) {
BluetoothForAndroid.WriteMessage(message);
}
// go to menu and disconnect
public void ExitGameScene() {
BluetoothForAndroid.Disconnect();
SceneManager.LoadScene(0);
}
// converting float to byte array and back from byte array to float
public byte[] FloatToBytes(float f) {
byte[] bytes = BitConverter.GetBytes(f);
return bytes;
}
public float BytesToFloat(byte[] bytes) {
float f = BitConverter.ToSingle(bytes, 0);
return f;
}
}

13
Assets/Simple Bluetooth for android/Demos/Game Example/Scripts/NetworkManager.cs.meta

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 7cc3a4cce05ad5c459f3424cb3d519ee
timeCreated: 1550409650
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 380
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

10
Assets/Simple Bluetooth for android/Demos/Game Example/Sprites.meta

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: b5f03b7cbd0d5e04b88ee736cbf45ab8
folderAsset: yes
timeCreated: 1551017322
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Simple Bluetooth for android/Demos/Game Example/Sprites/square.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 B

92
Assets/Simple Bluetooth for android/Demos/Game Example/Sprites/square.png.meta

@ -1,92 +0,0 @@ @@ -1,92 +0,0 @@
fileFormatVersion: 2
guid: be512834820d5374daee427f5415a41f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Simple Bluetooth for android/Demos/Game Example/Sprites/whiteCircle.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

92
Assets/Simple Bluetooth for android/Demos/Game Example/Sprites/whiteCircle.png.meta

@ -1,92 +0,0 @@ @@ -1,92 +0,0 @@
fileFormatVersion: 2
guid: 3efaee611ea0d004e8234e749d01f1ce
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

10
Assets/Simple Bluetooth for android/Demos/Usage Example.meta

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: ec221ccc78c4b2b42b2ee64cef1fdc0c
folderAsset: yes
timeCreated: 1551017188
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

10
Assets/Simple Bluetooth for android/Demos/Usage Example/Scenes.meta

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: b69edb1f310e31f4bacc80c9dc0f975a
folderAsset: yes
timeCreated: 1551017322
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

3687
Assets/Simple Bluetooth for android/Demos/Usage Example/Scenes/Main.unity

File diff suppressed because it is too large Load Diff

9
Assets/Simple Bluetooth for android/Demos/Usage Example/Scenes/Main.unity.meta

@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 5ee912e5d6c228c4da0b2ca1d53a001e
timeCreated: 1551017322
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

10
Assets/Simple Bluetooth for android/Demos/Usage Example/Scripts.meta

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 9a4a6df4565d3d84bb65ea370579254f
folderAsset: yes
timeCreated: 1551017322
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

168
Assets/Simple Bluetooth for android/Demos/Usage Example/Scripts/Interface.cs

@ -1,168 +0,0 @@ @@ -1,168 +0,0 @@
using UnityEngine;
using UnityEngine.UI;
using SVSBluetooth;
using System.Text;
public class Interface : MonoBehaviour {
public Image image; // a picture that displays the status of the bluetooth adapter upon request
public Text textField; // field for displaying messages and events
const string MY_UUID = "0b7062bc-67cb-492b-9879-09bf2c7012b2"; // UUID constant which is set via script
//00001101-0000-1000-8000-00805F9B34FB for arduino
BluetoothForAndroid.BTDevice[] devices;
string lastConnectedDeviceAddress;
// subscription and unsubscribe from events. You can read more about events in Documentation.pdf
private void OnEnable() {
Screen.sleepTimeout = SleepTimeout.NeverSleep;
BluetoothForAndroid.ReceivedIntMessage += PrintVal1;
BluetoothForAndroid.ReceivedFloatMessage += PrintVal2;
BluetoothForAndroid.ReceivedStringMessage += PrintVal3;
BluetoothForAndroid.ReceivedByteMessage += PrintVal4;
BluetoothForAndroid.BtAdapterEnabled += PrintEvent1;
BluetoothForAndroid.BtAdapterDisabled += PrintEvent2;
BluetoothForAndroid.DeviceConnected += PrintEvent3;
BluetoothForAndroid.DeviceDisconnected += PrintEvent4;
BluetoothForAndroid.ServerStarted += PrintEvent5;
BluetoothForAndroid.ServerStopped += PrintEvent6;
BluetoothForAndroid.AttemptConnectToServer += PrintEvent7;
BluetoothForAndroid.FailConnectToServer += PrintEvent8;
BluetoothForAndroid.DeviceSelected += PrintDeviceData;
}
private void OnDisable() {
BluetoothForAndroid.ReceivedIntMessage -= PrintVal1;
BluetoothForAndroid.ReceivedFloatMessage -= PrintVal2;
BluetoothForAndroid.ReceivedStringMessage -= PrintVal3;
BluetoothForAndroid.ReceivedByteMessage -= PrintVal4;
BluetoothForAndroid.BtAdapterEnabled -= PrintEvent1;
BluetoothForAndroid.BtAdapterDisabled -= PrintEvent2;
BluetoothForAndroid.DeviceConnected -= PrintEvent3;
BluetoothForAndroid.DeviceDisconnected -= PrintEvent4;
BluetoothForAndroid.ServerStarted -= PrintEvent5;
BluetoothForAndroid.ServerStopped -= PrintEvent6;
BluetoothForAndroid.AttemptConnectToServer -= PrintEvent7;
BluetoothForAndroid.FailConnectToServer -= PrintEvent8;
BluetoothForAndroid.DeviceSelected -= PrintDeviceData;
}
// Initially, always initialize the plugin.
public void Initialize() {
BluetoothForAndroid.Initialize();
}
// methods for controlling the bluetooth and getting its state
public void GetBluetoothStatus() {
if (BluetoothForAndroid.IsBTEnabled()) image.color = Color.green;
else image.color = Color.red;
}
public void EnableBT() {
BluetoothForAndroid.EnableBT();
}
public void DisableBT() {
BluetoothForAndroid.DisableBT();
}
// methods for creating and stopping the server, connecting to the server and disconnecting
public void CreateServer() {
BluetoothForAndroid.CreateServer(MY_UUID);
}
public void StopServer() {
BluetoothForAndroid.StopServer();
}
public void ConnectToServer() {
BluetoothForAndroid.ConnectToServer(MY_UUID);
}
public void Disconnect() {
BluetoothForAndroid.Disconnect();
}
public void ConnectToServerByAddress() {
if (devices != null) {
if (devices[0].address != "none") BluetoothForAndroid.ConnectToServerByAddress(MY_UUID, devices[0].address);
}
}
public void ConnectToLastServer() {
if (lastConnectedDeviceAddress != null) BluetoothForAndroid.ConnectToServerByAddress(MY_UUID, lastConnectedDeviceAddress);
}
// methods for sending messages of various types
public void WriteMessage1() {
BluetoothForAndroid.WriteMessage(15);
}
public void WriteMessage2() {
BluetoothForAndroid.WriteMessage(100.69f);
}
public void WriteMessage3() {
BluetoothForAndroid.WriteMessage("Hi !!!");
}
public void WriteMessage4() {
BluetoothForAndroid.WriteMessage(new byte[] { 0, 1, 2, 3, 4, 5 });
}
// methods for displaying received messages on the screen
void PrintVal1(int val) {
textField.text += val.ToString() + "\n";
}
void PrintVal2(float val) {
textField.text += val.ToString() + "\n";
}
void PrintVal3(string val) {
textField.text += val + "\n";
}
void PrintVal4(byte[] val) {
foreach (var item in val) {
textField.text += item;
}
textField.text += "\n";
}
public void GetBondedDevices() {
devices = BluetoothForAndroid.GetBondedDevices();
if (devices != null) {
for (int i = 0; i < devices.Length; i++) {
textField.text += devices[i].name + " ";
textField.text += devices[i].address;
textField.text += "\n";
}
}
}
// methods for displaying events on the screen
void PrintEvent1() {
textField.text += "Adapter enabled" + "\n";
}
void PrintEvent2() {
textField.text += "Adapter disabled" + "\n";
}
void PrintEvent3() {
textField.text += "The device is connected" + "\n";
}
void PrintEvent4() {
textField.text += "Device lost connection" + "\n";
}
void PrintEvent5() {
textField.text += "Server is running" + "\n";
}
void PrintEvent6() {
textField.text += "Server stopped" + "\n";
}
void PrintEvent7() {
textField.text += "Attempt to connect to server" + "\n";
}
void PrintEvent8() {
textField.text += "Connection to the server failed" + "\n";
}
void PrintDeviceData(string deviceData) {
string[] btDevice = deviceData.Split(new char[] { ',' });
textField.text += btDevice[0] + " ";
textField.text += btDevice[1] + "\n";
lastConnectedDeviceAddress = btDevice[1];
}
// method for cleaning the log
public void ClearLog() {
textField.text = "";
}
}

13
Assets/Simple Bluetooth for android/Demos/Usage Example/Scripts/Interface.cs.meta

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 581b18b84bb3f024884100f13109f8a5
timeCreated: 1551017322
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

10
Assets/Simple Bluetooth for android/Documentation.meta

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: acc77dbf5e6c54f45a2554804df77e61
folderAsset: yes
timeCreated: 1551018793
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Simple Bluetooth for android/Documentation/Documentation.pdf

Binary file not shown.

9
Assets/Simple Bluetooth for android/Documentation/Documentation.pdf.meta

@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: dad1a25031f10da43b6b42866927247b
timeCreated: 1551018793
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Simple Bluetooth for android/Documentation/Readme.pdf

Binary file not shown.

9
Assets/Simple Bluetooth for android/Documentation/Readme.pdf.meta

@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 3e8bf5dac9a207249a63e5979ad5881d
timeCreated: 1551019374
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Loading…
Cancel
Save