| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using SmartBowSDK;
- public class SmartBowHandler
- {
- SmartBowHelper smartBowHelper;
- Bow bow;
- public SmartBowHandler(SmartBowHelper smartBowHelper, Bow bow)
- {
- smartBowHelper.OnBluetoothModuleInited += OnBluetoothModuleInited;
- smartBowHelper.OnRotationUpdate += OnRotationUpdate;
- smartBowHelper.OnShooting += OnShooting;
- smartBowHelper.OnFunctionKeyPress += OnFunctionKeyPress;
- this.smartBowHelper = smartBowHelper;
- this.bow = bow;
- }
- void OnBluetoothModuleInited()
- {
- smartBowHelper.StartRotationSensor();
- smartBowHelper.StartShootingSensor();
- }
- void OnRotationUpdate(Quaternion rotation)
- {
- bow.transform.localRotation = rotation;
- }
- void OnShooting(float speed)
- {
- bow.Shoot();
- }
- void OnFunctionKeyPress()
- {
- smartBowHelper.ResetAim();
- }
- }
|