Hi,推荐文件给你 "Unity3D用按钮控制人物行走.zip" http://vdisk.weibo.com/s/JaBAq
//动画数组
private var animUp:Object[];
private var animDown:Object[];
private var animLeft:Object[];
private var animRight:Object[];
//地图
private var map:Texture2D;
//当前人物的动画
private var tex:Object[];
//人物的x坐标
private var x: int;
//人物的y坐标
private var y: int;
//帧序列
private var nowFram :int;
//动画帧的总数量
private var mframeCount:int;
//每秒更新多少帧
private var fps:float = 3;
private var time:float = 0;
function Start ()
{
//获取图片资源
animUp = Resources.LoadAll("up");
animDown = Resources.LoadAll("down");
animLeft = Resources.LoadAll("left");
animRight = Resources.LoadAll("right");
//地图的图片
map = Resources.Load("map/map");
//设置默认动画
tex = animUp;
}
function OnGUI()
{
//绘制贴图
GU