Escape From The Earth 逃离地球

1、对Tags进行管理
设置一个全局的类,类似如下:
public class Tags:MonoBehaviour{
public const string player="Player";
}
调用Tags.player
2、发送消息
unity中每一个对象都有SendMessage,BroadcastMessage,SendMessageUpwards 三个发送消息的方法!
具体使用方法参考:http://www.cnblogs.com/MrZivChu/p/sendmessage.html
3、利用iTween绘制路径线
public Transform[] points;
public void OnDrawGizmos()
{
iTween.DrawPath(points);
}

4、人物移动
;
public Vector3 targetPosition;
void Update()
{ //获得人物前进方向
Vec tor3 moveDir = targetPosition - transform.position;
transform.positon += moveDir.normalized * moveSpeed * Time.deltaTime;
}
5、获得障碍物生成的点
因为地形是不平整的,有高低起伏的,所以我们的障碍物生成点是根据比率来算的
Vector3.Lerp(prePoint,nextPoint,(z-prePoint.z) / (nextPoint.z - prePoint.z)) // Lerp会根据第三个参数(比率)来算出上一个点和下一个点之间的一个点
6、动画队列
animation.Play("Idle1");
animation.PlayQueued("Idle2");//把Idle2动画加入队列,也就是说,当Idle1播放完,就去播放Idle2的动画
7、获得触摸方向(鼠标)
public enum TouchDir
{
None,
Left,
Right,
Top,
Bottom
}
Vector3 lastMouseDown = Vector3.zero;
TouchDir GetTouchDir()
{
))
{
lastMouseDown = Input.mousePosition;
}
))
{
Vector3 mouseUp = Input.mousePosition;
Vector3 touchOffset = mouseUp - lastMouseDown;
|| Mathf.Abs(touchOffset.y) > )
{
)
{
return TouchDir.Right;
}
)
{
return TouchDir.Left;
}
)
{
return TouchDir.Top;
}
)
{
return TouchDir.Bottom;
}
}
}
return TouchDir.None;
}
8、根据动画时长计时完成动画播放
bool slide = true;
float allTime = 1.73f;//此动画总共时间为1.73s
;
void LateUpdate()
{
if (slide)
{
initTime += Time.deltaTime;
if (initTime > allTime)
{
initTime = ;
slide = false;
}
animation.Play("slide");
}
}
9、人物跳跃

Escape From The Earth 逃离地球的更多相关文章
- (29)Why Earth may someday look like Mars
https://www.ted.com/talks/anjali_tripathi_why_earth_may_someday_look_like_mars/transcript00:12So whe ...
- 五、Pandas玩转数据
Series的简单运算 import numpy as np import pandas as pd s1=pd.Series([1,2,3],index=['A','B','C']) print(s ...
- HDU 3605 Escape(状压+最大流)
Escape Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Sub ...
- Help Me Escape (ZOJ 3640)
J - Help Me Escape Crawling in process... Crawling failed Time Limit:2000MS Memory Limit:32768KB ...
- ZOJ- 3640 Help Me Escape
Help Me Escape Time Limit: 2 Seconds Memory Limit: 32768 KB Background If thou doest well, ...
- ZOJ3640-Help Me Escape
Help Me Escape Time Limit: 2 Seconds Memory Limit: 32768 KB Background If thou doest well, ...
- Help Me Escape ZOJ - 3640
Background If thou doest well, shalt thou not be accepted? and if thou doest not well, sin lieth ...
- Escape HDU - 3605(归类建边)
Escape Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Subm ...
- HDU 3605 Escape (网络流,最大流,位运算压缩)
HDU 3605 Escape (网络流,最大流,位运算压缩) Description 2012 If this is the end of the world how to do? I do not ...
随机推荐
- POJ-1509 Glass Beads---最小表示法模板
题目链接: https://vjudge.net/problem/POJ-1509 题目大意: 给你一个循环串,然后找到一个位置,使得从这个位置开始的整个串字典序最小. 解题思路: 最小表示法模板 注 ...
- 2018.7.8 xmlhttp.readyState==4 && xmlhttp.status==200是什么意思
在做DOM模型的XML实验的时候遇到了问题 代码实例: xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && ...
- web攻击技术与防护
一.跨站脚本攻击(XSS) 跨站脚本攻击是指通过存在安全漏洞的Web网站注册用户的浏览器运行非法的HTML标签或JavaScript进行的一种攻击.动态创建的HTML部分有可能隐藏着安全漏洞.就这样, ...
- (排班表一)使用SQL语句使数据从坚向排列转化成横向排列
知识重点: 1.extract(day from schedule01::timestamp)=13 Extract 属于 SQL 的 DML(即数据库管理语言)函数,同样,InterBase 也支持 ...
- Ajax上传文件/照片时报错TypeError :Illegal invocation
问题 Ajax上传文件/照片时报错TypeError :Illegal invocation 解决 网上搜索问题,错误原因可能有以下几个,依次检查: 请求类型有误,如post请求,但在后台设置的是ge ...
- 使用myeclipse创建servlet后输入地址无法访问
问题: 使用myeclipse创建servlet后输入地址无法访问 1.首先,路径的访问地址是在web.xml里设置的,一般会自动生成(但是可能会和你自己输入的有出入) 你必须按照<url-pa ...
- 【Effective C++ 读书笔记】条款03: 尽量使用 const
关键字const多才多艺,变化多端却不高深莫测. const 修饰指针 面对指针, 你可以指出 指针自身.指针所指物.或者两者都不是 const. 如果关键字 const 出现在星号左边,表示被指物是 ...
- OracleWeblogic12C安装教程
一,安装WebLogic Server 1. 双击exe安装文件 2.准备安装文件 3. 生成向导序列 4. 选择安装路径 5. 开始安装 经过以上步骤,weblogic已经成功安装到了你的电脑上,但 ...
- 微信小程序插件内页面跳转和参数传递
在此以插件开发中文章列表跳传文章详情为例. 1.首先在插件中的文章列表页面wxml中绑定跳转事件. bindtap='url' data-id="{{item.article_id}}&qu ...
- 详解JavaScript中的arc的方法
今天说说JavaScript在网页中画圆的函数arc! 一.arc所需要的参数设置 1 arc(x, y, radius, startAngle, endAngle, counterclockwise ...