zoukankan      html  css  js  c++  java
  • Horizontal,vertical,Input_Mouse,Input_Key

    鼠标获取
    using UnityEngine;
    using System.Collections;
    
    public class Input_Mouse : MonoBehaviour {
    
    	void Update()
    	{
    //		if (Input.GetMouseButtonDown (0)) {
    //			Debug.Log ("按下了鼠标左键");
    //		}
    //
    //		if (Input.GetMouseButtonUp (0)) {
    //			Debug.Log ("抬起了鼠标左键");
    //		}
    //
    //		if (Input.GetMouseButton (0)) {
    //			Debug.Log ("按住了鼠标左键");
    //		}
    
    		Debug.Log (Input.mousePosition);
    	}
    }
    
    
    

     按键获取

    using UnityEngine;
    using System.Collections;
    
    public class Input_Key : MonoBehaviour {
    
    
    	void Update()
    	{
    		//当用户按下了空格键盘,if成立(为真)
    		if (Input.GetKeyDown (KeyCode.Space)) {
    			Debug.Log ("按下了空格!!!");
    		}
    
    		if (Input.GetKey (KeyCode.Space)) {
    			Debug.Log ("按住了空格!!!");
    		}
    
    		if (Input.GetKeyUp (KeyCode.Space)) {
    			Debug.Log ("抬起了空格!!!");
    		}
    	}
    }
    

      WASD获取

    using UnityEngine; using System.Collections; public class Virtual : MonoBehaviour { void Update() { float h = Input.GetAxis ("Horizontal"); float v = Input.GetAxis ("Vertical"); Debug.Log (v); } }
  • 相关阅读:
    一.创建型模式 Factory
    Tcp/Ip I/O函数
    Tcp/Ip协议理解_简单实例
    Tcp/Ip协议理解_3
    Tcp/Ip协议理解_2
    Tcp/Ip协议理解_1
    abp+angular+bootstrap-table的使用
    Abp mvc angular 添加视图
    Abp添加菜单
    JS 获取一串路径中的文件名称
  • 原文地址:https://www.cnblogs.com/VR-1024/p/6011042.html
Copyright © 2011-2022 走看看