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 ...
随机推荐
- 数据库连接-ADO.NET
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/huo065000/article/details/25830291 非常早就知道了ADO ...
- cudpp库的编译和使用
项目主页 http://cudpp.github.io/ 根据这个网址的提示进行 https://github.com/cudpp/cudpp/wiki/BuildingCUDPPwithCMake ...
- django批量form表单处理
1.应用说明 一般在表单信息录入中,如果存在许多重复提交的信息,我们就需要进行批量处理,比如学生信息的批量录入. 这里一种方式就是使用xlrd模块处理,把学生信息录入到系统内 另外一种方式就是采用我们 ...
- JS中的执行环境和作用域
window 是最大最外围的执行环境,然后每个函数都有自己的执行环境.JS代码是从上到下执行的,单纯的用语言描述可能会有点绕,而且不大直观.我们看着代码来 console.log('global be ...
- Mybatis查询报错:There is no getter for property named '*' in 'class java.lang.String
问题: 执行查询时报错:There is no getter for property named '*' in 'class java.lang.String 原因: 传过去的参数为识别.本例为 p ...
- 利用deadline_timer实现定时器Timer
// 类似QTimer的定时器 class Timer { typedef void(* handler)(); public: Timer() : m_millseconds() , m_timer ...
- LeetCode94. Binary Tree Inorder Traversal
题目 给定一个二叉树,返回它的中序 遍历. 示例: 输入: [1,null,2,3] 1 \ 2 / 3 输出: [1,3,2] 进阶: 递归算法很简单,你可以通过迭代算法完成吗? 考点 stack ...
- Django 入门案例开发
Django是一个重量级的web开发框架,它提供了很多内部已开发好的插件供我们使用:这里不去描述 Django直接进入开发过程. Django入门案例分两部分:一.开发环境的配置:二.业务需求分析. ...
- 判断StringBuilder 是否为空
if("".equals(stringbuilder.toString())) do..
- input属性总结
<input type="text" readonly="readonly" /> 这个是不能输入的 readonly="readonly ...