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); } }
  • 相关阅读:
    线程queue
    定时器
    event模拟数据库链接
    最速下降法(梯度下降法)
    神经网络中的反向传播算法
    批量学习和在线学习的区别
    LMS算法
    粒子群算法
    遗传算法
    logistic回归
  • 原文地址:https://www.cnblogs.com/VR-1024/p/6011042.html
Copyright © 2011-2022 走看看