码迷,mamicode.com
首页 > 其他好文 > 详细

黑暗之光2-鼠标滑动控制视野的旋转

时间:2018-03-02 01:27:28      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:log   tin   鼠标   inf   ota   UI   key   for   cto   

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-鼠标滑动控制视野的旋转

标签:log   tin   鼠标   inf   ota   UI   key   for   cto   

原文地址:https://www.cnblogs.com/xiaomao21/p/8490823.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!