private void OnStartMove(TSVector position, TSVector forward) { List <Vector3> lst = GameInTool.TSVectorToLstUnityVector3(m_cMove.lstNextPosition); m_cLerpMoveView.StartMove(transform.position, lst); RotateToTarget(forward); }
protected override void HandleMsg(Frame_ReqMoveForward_Data msg) { Unit unit = BattleScene.Instance.GetUnit(msg.unitId); if (unit != null) { unit.MoveForward(GameInTool.ToTSVector(msg.forward)); } }
protected override void HandleMsg(Frame_ReqSetPosition_Data msg) { Unit unit = BattleScene.Instance.GetUnit(msg.unitId); if (null != unit) { unit.SetPosition(GameInTool.ToTSVector(msg.position)); } }
public void ReqMoveForward(TSVector direction) { if (CanMove() && (TSVector.Angle(curForward, direction) > FP.EN1 || !m_cMove.isMoving)) { Frame_ReqMoveForward_Data data = new Frame_ReqMoveForward_Data(); data.unitId = id; data.forward = GameInTool.ToProtoVector2(direction); NetSys.Instance.SendMsg(NetChannelType.Game, (short)PacketOpcode.Frame_ReqMoveForward, data); } }
public void ReqMove(TSVector targetPosition) { if (CanMove()) { Frame_ReqMovePoint_Data data = new Frame_ReqMovePoint_Data(); data.unitId = id; data.targetPosition = GameInTool.ToProtoVector2(targetPosition); NetSys.Instance.SendMsg(NetChannelType.Game, (short)PacketOpcode.Frame_ReqMovePoint, data); } }
protected override void HandleMsg(Frame_ReqMovePoint_Data msg) { Unit unit = BattleScene.Instance.GetUnit(msg.unitId); if (null != unit) { TSVector targetPosition = GameInTool.ToTSVector(msg.targetPosition); unit.Move(targetPosition); } }
public Remote CreateRemote(int configId, int campId, TSVector position, TSVector forward, uint targetAgentId, AgentObjectType targetAgentType, TSVector targetPosition, TSVector targetForward) { Remote remote = BehaviourPool <Remote> .Instance.GetObject(m_cRemoteRoot.transform); uint remoteId = GameInTool.GenerateRemoteId(); remote.Init(remoteId, configId, campId, position, forward, targetAgentId, targetAgentType, targetPosition, targetForward); m_cRemoteContainer.Add(remote); return(remote); }
protected override void HandleMsg(Frame_ReqMovePath_Data msg) { Unit unit = BattleScene.Instance.GetUnit(msg.unitId); if (unit != null) { //这个移动是一帧处理的 List <TSVector> lstPath = GameInTool.ToLstTSVector(msg.paths); unit.Move(lstPath); } }
public void ReqSetPosition(TSVector position) { if (position == m_sCurPosition) { return; } Frame_ReqSetPosition_Data data = new Frame_ReqSetPosition_Data(); data.unitId = id; data.position = GameInTool.ToProtoVector2(position); NetSys.Instance.SendMsg(NetChannelType.Game, (short)PacketOpcode.Frame_ReqSetPosition, data); }
public void ReqSetForward(TSVector forward, bool immediately = true) { if (TSMath.Abs(TSVector.Angle(m_sCurForward, forward)) < FP.EN1) { return; } Frame_ReqSetForward_Data data = new Frame_ReqSetForward_Data(); data.unitId = id; data.forward = GameInTool.ToProtoVector2(forward); data.immediately = immediately; NetSys.Instance.SendMsg(NetChannelType.Game, (short)PacketOpcode.Frame_ReqSetForward, data); }
public void ReqDoSkill(int skillId, uint targetAgentId, AgentObjectType targetAgentType, TSVector position, TSVector forward) { if (CanDoSkill(skillId)) { Frame_ReqDoSkill_Data data = new Frame_ReqDoSkill_Data(); data.unitId = this.id; data.skillId = skillId; data.targetAgentId = targetAgentId; data.targetAgentType = (int)targetAgentType; data.position = GameInTool.ToProtoVector2(position); data.forward = GameInTool.ToProtoVector2(forward); NetSys.Instance.SendMsg(NetChannelType.Game, (short)PacketOpcode.Frame_ReqDoSkill, data); } }
public void ReqMove(List <TSVector> movePath) { if (movePath.Count <= 0) { return; } if (CanMove()) { Frame_ReqMovePath_Data data = new Frame_ReqMovePath_Data(); data.unitId = id; for (int i = 0; i < movePath.Count; i++) { data.paths.Add(GameInTool.ToProtoVector2(movePath[i])); } NetSys.Instance.SendMsg(NetChannelType.Game, (short)PacketOpcode.Frame_ReqMovePath, data); } }
public void StartMove(TSVector startPosition, List <TSVector> lstPosition) { TSVector forward = m_sCurForward; if (lstPosition.Count > 0) { forward = lstPosition[0] - startPosition; } if (!forward.IsZero()) { forward.Normalize(); } SetForward(forward); SetPosition(startPosition); List <Vector3> lst = GameInTool.TSVectorToLstUnityVector3(lstPosition); m_cLerpView.StartMove(transform.position, lst); }
public Unit CreateUnit(int configId, int campId, UnitType type, TSVector bornPosition, TSVector bornForward) { Unit unit = null; switch (type) { case UnitType.AirShip: unit = BehaviourPool <UnitAirShip> .Instance.GetObject(m_cUnitRoot.transform); break; } if (unit != null) { uint unitId = GameInTool.GenerateUnitId(); unit.name = "unit_" + type + "_" + unitId; unit.Init(unitId, configId, campId, type, bornPosition, bornForward); m_cUnitContainer.Add(unit); } return(unit); }
protected override void HandleMsg(S2C_StartBattle_Data msg) { GameInTool.InitRandomSeed(msg.seed); GlobalEventDispatcher.Instance.Dispatch(GameEvent.StartBattle); }
protected override void HandleMsg(Frame_ReqDoSkill_Data msg) { Unit unit = BattleScene.Instance.GetUnit(msg.unitId); if (unit != null) { unit.DoSkill(msg.skillId, msg.targetAgentId, (AgentObjectType)msg.targetAgentType, GameInTool.ToTSVector(msg.position), GameInTool.ToTSVector(msg.forward)); } }