赞
踩
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
//Pos
Vector3 pos =
this
.transform.position;
float
horizontal = Input.GetAxis(
"Horizontal"
);
float
vertical = Input.GetAxis(
"Vertical"
);
if
(Mathf.Abs(horizontal) > 0.0001f)
//左右移动
{
pos.x += Time.deltaTime * horizontal * Speed;
}
if
(Mathf.Abs(vertical) > 0.0001f)
//上下移动
{
pos.y += Time.deltaTime * vertical * Speed;
}
this
.transform.position = pos;
HistoryPos.Add(pos);
|
1
2
3
4
5
6
|
if
(HistoryPos.Count > 0)
{
int
index = HistoryPos.Count - 1;
this
.transform.position = HistoryPos[index];
HistoryPos.RemoveAt(index);
}
|
1
2
3
4
5
6
|
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。