public static MyRole getMyRole() { if (myRole == null) { myRole = new MyRole(); } return myRole; }
public static MyRole getInstance() { if (instance == null) { instance = new MyRole(); } return instance; }
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); }
void initMyRole() { myRole = MyRole.getInstance(); myRole.id = 1001; myRole.reset(); myRole.play(AvatarUtil.ACT_STAND); myRole.resetPos(new Vector3(110, 1, 130)); }