private void Move(MoveDTO value) { Vector3 target = new Vector3( value.X,value.Y,value.Z); models[value.UserID].SendMessage("Move",target); }
/// <summary> /// 移动 /// </summary> /// <param name="token"></param> /// <param name="value"></param> private void Move(UserToken token,MoveDTO value) { int userID = GetUserId(token); value.UserID = userID; Brocast(FightProtocol.MOVE_BRO,value); }
public void RightClick(Vector3 pos) { Ray ray = mainCamera.ScreenPointToRay(pos); RaycastHit[] hits = Physics.RaycastAll(ray, 200); for (int i = hits.Length - 1; i >=0; i--) { //如果是地方单位进行普通攻击 if(hits[i].transform.gameObject.layer == LayerMask.NameToLayer("Enemy")) { PlayerCtr ctr = hits[i].transform.GetComponent<PlayerCtr>(); if(Vector3.Distance(hero.transform.position,hits[i].transform.position)<ctr.data.AtkRange) { this.Wirte(Protocol.TYPE_FIGHT, 0, FightProtocol.ATTACK_CREQ, ctr.data.Id); return; } continue; } //己方单位无视 //如果是地板层 则开始寻路 if(hits[i].transform.gameObject.layer == LayerMask.NameToLayer("Water")) { MoveDTO dto = new MoveDTO(); dto.X = hits[i].point.x; dto.Y = hits[i].point.y; dto.Z = hits[i].point.z; this.Wirte(Protocol.TYPE_FIGHT,0,FightProtocol.MOVE_CREQ,dto); return; } } }