using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class JoyStickHandler : MonoBehaviour, IPointerDownHandler, IDragHandler, IPointerUpHandler
{
///
/// 摇杆水平偏移量
///
public static float js_x;
///
/// 摇杆垂直偏移量
///
public static float js_y;
// 当前模式
public static Mode CurrentMode;
///
/// 摇杆模式
///
public enum Mode { None, Up, Down, Left, Right };
///
/// 背景图片RectTransform
///
[Tooltip("背景图片RectTransform")]
public RectTransform background;
///
/// Handle的RectTransform
///
[Tooltip("Handle的RectTransform")]
public RectTransform handle;
///
/// 摇杆速度偏移量
///
[Tooltip("摇杆速度偏移量")]
public float js_Speed = 1f;
///
/// 画布
///
[Tooltip("摇杆所在的画布对象")]
private Canvas canvas;
// 半径
float radius;
// 上下左右的向量
Vector2 up, down, left, right;
public bool TestOnEditor;
Color handleColor;
void Start()
{
if (!TestOnEditor && !H5Controller.IsMobileBroswer())
{
Destroy(gameObject);
}
canvas = transform.parent.parent.GetComponent