完整代码
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
///
/// 就是利用Stack的原理来获取历史位置
/// 如果同时有动画,把动画倒放就是
///
public class TBPlayer : MonoBehaviour {
public int Speed = 3;
public int RotateSpeed = 100;
public bool ShouldLimit = false;
public int Limit = 100; //可以存放的坐标上限
private List HistoryPos;
private List HistoryRot;
private bool _IsTimeBack = false;
void Start () {
HistoryPos = new List();
HistoryRot = new List();
}
void Update () {
if (_IsTimeBack)
TimeBack();
else
ControlPos();
}