public void addUnit(SceneUnit unit, double id, int pos, object vo, int dir = 4) { unit.id = id; enterPoint = TileUitls.getFlatCenterByPosWithVertor3(pos, enterPoint); if (unit is MyRole) { unit.reset(); //(unit).reset(vo); if (unit is MyRole) { myRole = unit as MyRole; //centerCamera(hero.x, hero.y); } } else { unit.reset(); unit.play(AvatarUtil.ACT_STAND); //unitCache.push([unit, vo, id, 1]); } unit.setParent(midLayer); unit.resetPos(enterPoint); SceneUnitMgr.addUnit(unit); }