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); } }
Horizontal,vertical,Input_Mouse,Input_Key的更多相关文章
- HTML5移动开发学习笔记之CSS3基础学习
CSS回顾 在学CSS3之前首先巩固下CSS的基础知识. 1.CSS框模型 举例子: #box { width: 70px; margin: 10px; padding: 5px; } 这个代码将出现 ...
- gridview安卓实现单行多列横向滚动
<GridLayout android:layout_width="match_parent" android:layout_height="match_paren ...
- [LeetCode] Design Tic-Tac-Toe 设计井字棋游戏
Design a Tic-tac-toe game that is played between two players on a n x n grid. You may assume the fol ...
- [LeetCode] Game of Life 生命游戏
According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellul ...
- flex的兼容
父容器的 display 属性: .box{ display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit br ...
- (转)详解css3弹性盒模型(Flexbox)
今天刚学了css3的弹性盒模型,这是一个可以让你告别浮动.完美实现垂直水平居中的新特性. Flexbox是布局模块,而不是一个简单的属性,它包含父元素和子元素的属性. Flexbox布局的主体思想是似 ...
- CSS魔法堂:Box-Shadow没那么简单啦:)
前言 说起box-shadow那第一个想法当然就是用来实现阴影,其实它还能用于实现其他好玩的效果的,本篇就打算说说box-shadow的那些事. 二话不说看效果 3D小球 <style typ ...
- Android开发5:应用程序窗口小部件App Widgets的实现
前言 本次主要是实现一个Android应用,实现静态广播.动态广播两种改变 widget内容的方法,即在上篇博文中实验的基础上进行修改,所以此次实验的重点是AppWidget小部件的实现啦~ 首先,我 ...
- Android开发1:基本UI界面设计——布局和组件
前言 啦啦啦~本学期要开始学习Android开发啦~ 博主在开始学习前是完完全全的小白,只有在平时完成老师要求的实验的过程中一步一步学习~从此篇博文起,博主将开始发布Android开发有关的博文,希望 ...
随机推荐
- PullToRefresh下拉刷新 加载更多 详解 +示例
常用设置 项目地址:https://github.com/chrisbanes/Android-PullToRefresh a. 设置刷新模式 如果Mode设置成Mode.PULL_FROM_STAR ...
- el和jstl
<%@page import="cn.bdqn.bean.News"%> <%@ page language="java" import=&q ...
- C# Gma.QrCodeNet生成二维码
一.使用C#生成二维码类库之一是qrcodenet 源代码地址: http://qrcodenet.codeplex.com/ 二.使用实例 定义处理字符串 static string url = & ...
- Design Pattern ——Builder
一.基础知识:先前学习建造者模式的时候,总是以这个UML图作为学习基础资料 然后总是要记住四个角色 产品类:一般是一个较为复杂的对象,也就是说创建对象的过程比较复杂,一般会有比较多的代码量.在本类图中 ...
- 原生js 学习之array 数组
Array的原生方法: concat(): 连接两个或更多的数组哦 join(): 把数组的所有元素放在一个字符串中 pop():删除并返回数组的最后一个元素 push():向数组的末尾添加一个元素 ...
- 初级班 Linux使用
ifconfig 查看IP地址 重新启动网卡服务 service network restart 笔记 1.通过远程工具登陆到linux后,所在的位置是当前登录用户的家目录(home director ...
- CADisplayLink的简单使用
CADisplayLink类似NSTimer是一个定时器,只不过是一秒会调用60次指定的方法 使用方法: #import "ViewController.h" @interface ...
- 读取XML文件的几种方式的效率分析
第一种:使用XmlReader来读取. Stopwatch sw = Stopwatch.StartNew(); List<Dictionary<string, string>> ...
- c++虚函数的学习
1.虚函数 #include<iostream.h> class Base { public: void print() { cout<<"Base"< ...
- linux vi 使用脑图