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 ...
随机推荐
- SpringMVC接受JSON参数详解
转:https://blog.csdn.net/LostSh/article/details/68923874 SpringMVC接受JSON参数详解及常见错误总结 最近一段时间不想使用Session ...
- Hubtown(最大流)
Hubtown 时间限制: 1 Sec 内存限制: 128 MB提交: 23 解决: 11[提交] [状态] [讨论版] [命题人:admin] 题目描述 Hubtown is a large N ...
- barnes-hut算法 && Fast Multipole Methods算法
barnes-hut算法 http://arborjs.org/docs/barnes-hut Fast Multipole Methods算法 http://www.umiacs.umd.edu/~ ...
- chrome 浏览器插件开发(二)—— 通信 获取页面变量 编写chrome插件专用的库
在chrome插件的开发过程中,我遇到了一些问题,在网上找了不少文章,可能是浏览器升级的原因,有一些是有效的也有无效的.下面我简单的分享一下我遇到的坑,以及我把这些坑的解决方案整理而成的js库 —— ...
- 旧文备份:rtlinux安装手册
前段时间接触了几天RTLinux,折腾了好几天才总算把它安装上,得益于Prof. Chang-Gun Lee的安装建议,觉得该文档可能会对准备尝试安装RTLinux的朋友们有帮助,本人英语很烂,也比较 ...
- 带有data-ng-bind表达式
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...
- SqlServer中怎么删除重复的记录(表中没有id)
SqlServer中怎么删除重复的记录(表中没有id) 其实我在别的网址也查到过删除重复的记录,不知道我是我SqlServer2012版本太低还是啥原因 delete from scwhere (c# ...
- Leetcode463. Island Perimeter
题目 给定一个包含 0 和 1 的二维网格地图,其中 1 表示陆地 0 表示水域. 网格中的格子水平和垂直方向相连(对角线方向不相连).整个网格被水完全包围,但其中恰好有一个岛屿(或者说,一个或多个表 ...
- LOJ#515. 「LibreOJ β Round #2」贪心只能过样例(bitset)
内存限制:256 MiB时间限制:1000 ms标准输入输出 题目类型:传统评测方式:文本比较 上传者: nzhtl1477 提交提交记录统计讨论测试数据 题目描述 一共有 nnn个数,第 iii ...
- 传输控制协议(TCP)
传输控制协议(TCP)[来自Unix网络编程(卷一)第2章] 1.TCP是一个面向连接.可靠性的传输协议: 2.TCP含有用于动态估算客户与服务器之间往返时间(RTT)的算法,以便它知道等待一个确认需 ...