public void Activate(RailPoint point) { if (isSwitch) { StopCoroutine("resetPoint"); nextPoint = null; InputManager mgr = (InputManager)GameObject.Find("InputManager").GetComponent("InputManager"); for (direction = (InputCode)0; direction < InputCode.Button1 && Switches[(int)direction] != point; direction++) { } for (InputCode i = (InputCode)0; i < InputCode.Button1; ++i) { if (i != direction && Switches[(int)i] != null) { mgr.RegisterListener(this, i); } } } else { foreach (RailPoint i in Switches) { if (i != null && i != point) { nextPoint = i; } } } }
IEnumerator resetPoint() { yield return(new WaitForSeconds(joystickResetTime)); nextPoint = this; yield return(null); }
private void getNextPoint() { RailPoint last = targetRailPoint; targetRailPoint = targetRailPoint.nextPoint; getDirectionVec(last); }
/// <summary> /// 中国正常坐标系GCJ02协议的坐标,转到 百度地图对应的 BD09 协议坐标 /// </summary> /// <param name="lat">维度</param> /// <param name="lng">经度</param> public static void Convert_GCJ02_To_BD09(ref RailPoint rp) { double x = rp.X, y = rp.Y; double z = Math.Sqrt(x * x + y * y) + 0.00002 * Math.Sin(y * x_pi); double theta = Math.Atan2(y, x) + 0.000003 * Math.Cos(x * x_pi); rp.Y = z * Math.Cos(theta) + 0.0065; rp.X = z * Math.Sin(theta) + 0.006; }
public void GetPassThru() { InputCode passthru = (InputCode)(((int)direction + 2) % (int)InputCode.Button1); nextPoint = Switches[(int)passthru]; }
public override void RaiseEvent(InputCode ic) { nextPoint = Switches[(int)ic]; StopCoroutine("resetPoint"); StartCoroutine("resetPoint"); }
private void getDirectionVec(RailPoint last) { targetRailPoint.Activate(last); dir = targetRailPoint.transform.position - transform.position; dir.Normalize(); }