public void onClickUnit(SceneUnit tar) { switch (tar.sceneType) { case SceneUnitType.MONSTER_TYPE: doMonsterClick(tar as Monster); break; } }
public static void addUnit(SceneUnit unit) { if (_unitHash.ContainsKey(unit.id.ToString()) == false) { //总字典 _unitHash[unit.id.ToString()] = unit; } if (unit.sceneType == SceneUnitType.MONSTER_TYPE) { //怪物字典 if (_monsterHash.ContainsKey(unit.id.ToString()) == false) { _monsterHash[unit.id.ToString()] = unit; monsterNUM += 1; } } }
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); }
//更正发起者位置 private void updateFightUnitPos(SceneUnit src,m_fight_attack_toc fightVO) { if (src != null && fightVO.src_pos > 0) { //更正发起者位置 Vector3 pos = new Vector3(); pos = TileUitls.getFlatCenterByPosWithVertor3(fightVO.src_pos,pos); src.resetPos(pos); } }