1. 程式人生 > >黑暗之光2-鼠標滑動控制視野的旋轉

黑暗之光2-鼠標滑動控制視野的旋轉

read nsf input pub class tsp icamera 數據結構 obj

1.

Input.GetAxis("Mouse X");//得到鼠標在水平方向的滑動 2. if(Input.GetMouseButtonUp(1)){ isRotating=false; } if(isRotating){ transform.RotateAround(player.position,player.up,rotateSpeed*Input.GetAxis("Mouse X")); transform.RotateAround(player.position,transform.right,-rotateSpeed*Input.GetAxis("Mouse Y")); } offsetPosition=transform.position-player.position; 3. UICamera.hoveredObject==null滿足不可點擊在上面了 4.當鼠標放在之上的時候 private void OnMouseOver() { } 5.指針的設置 private Vector2 hotspot =Vector2.zero; private CursorMode mode=CursorMode.Auto; private void Start() { _instance=this; } public void SetNormal(){ Cursor.SetCursor(cursor_normal,hotspot,mode); } 6.得到字典 public ObjectInfo GetObjectInfoById(int id){ ObjectInfo info=null; objectInfoDict.TryGetValue(id,out info); return info; } 7. 檢驗是否正確數據結構 void Awake () { _instance=this; ReadInfo(); print(objectInfoDict.Keys.Count); }

黑暗之光2-鼠標滑動控制視野的旋轉