////////////////////////////////// /// private void EGMI_ACK_MOVE(int id, MemoryStream stream) { Debug.Log("Move " + Time.time); NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.ReqAckPlayerPosSync xData = NFMsg.ReqAckPlayerPosSync.Parser.ParseFrom(xMsg.MsgData); if (xData.SyncUnit.Count <= 0) { return; } NFMsg.PosSyncUnit syncUnit = xData.SyncUnit[0]; NFGUID xMover = mHelpModule.PBToNF(syncUnit.Mover); if (xMover.IsNull()) { Debug.LogError("xMover " + Time.time); return; } if (xMover == mLoginModule.mRoleID) { return; } GameObject xGameObject = mSceneModule.GetObject(xMover); if (!xGameObject) { Debug.LogError("xGameObject " + Time.time); return; } NFHeroMotor xHeroMotor = xGameObject.GetComponent <NFHeroMotor>(); if (!xHeroMotor) { Debug.LogError("xHeroSync " + Time.time); return; } UnityEngine.Vector3 v = new UnityEngine.Vector3(); v.x = syncUnit.Pos.X; v.y = syncUnit.Pos.Y; v.z = syncUnit.Pos.Z; xHeroMotor.MoveTo(v); }
private void EGMI_ACK_MOVE_IMMUNE(int id, MemoryStream stream) { Debug.Log("EGMI_ACK_MOVE_IMMUNE " + Time.time); NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.ReqAckPlayerPosSync xData = NFMsg.ReqAckPlayerPosSync.Parser.ParseFrom(xMsg.MsgData); if (xData.SyncUnit.Count <= 0) { return; } NFGUID xMover = mHelpModule.PBToNF(xData.Mover); if (xMover.IsNull()) { return; } GameObject xGameObject = mSceneModule.GetObject(xMover); if (!xGameObject) { return; } NFHeroSync xHeroSync = xGameObject.GetComponent <NFHeroSync>(); if (!xHeroSync) { return; } //TODO //GC---------- /* * UnityEngine.Vector3 v = new UnityEngine.Vector3(); * v.x = vector.X; * v.y = vector.Y; * v.z = vector.Z; */ //xHeroSync.AddSyncData(v); //float fSpeed = mKernelModule.QueryPropertyInt(xMover, NFrame.NPC.MOVE_SPEED) / 100.0f; //fSpeed *= 1.5f; //mSceneModule.MoveImmuneBySpeed(PBToNF(xData.mover), new Vector3(xData.target_pos[0].x, xData.target_pos[0].y, xData.target_pos[0].z), fSpeed, true); }
public override void Execute(GameObject gameObject) { base.Execute(gameObject); if (gameObject.transform.position.y < -10) { GameObject go = mSceneModule.GetObject(mLoginModule.mRoleID); if (go != null) { if (Vector3.Distance(go.transform.position, gameObject.transform.position) < 50) { vector3.x = gameObject.transform.position.x; vector3.y = 22; vector3.z = gameObject.transform.position.z; gameObject.transform.position = vector3; } } } }
public override void Execute(GameObject gameObject) { if (xHeroMotor.isOnGround) { mAnimatStateController.PlayAnimaState(NFAnimaStateType.JumpLand, -1); } else { if (gameObject.transform.position.y < -5) { GameObject go = mSceneModule.GetObject(mLoginModule.mRoleID); if (go != null) { if (Vector3.Distance(go.transform.position, gameObject.transform.position) < 50) { vector3.x = gameObject.transform.position.x; vector3.y = 22; vector3.z = gameObject.transform.position.z; gameObject.transform.position = vector3; } } } } }
////////////////////////////////// /// private void EGMI_ACK_MOVE(int id, MemoryStream stream) { Debug.Log("Move " + Time.time); NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.ReqAckPlayerPosSync xData = NFMsg.ReqAckPlayerPosSync.Parser.ParseFrom(xMsg.MsgData); if (xData.SyncUnit.Count <= 0) { return; } for (int i = 0; i < xData.SyncUnit.Count; ++i) { NFMsg.PosSyncUnit syncUnit = xData.SyncUnit[i]; NFGUID xMover = mHelpModule.PBToNF(syncUnit.Mover); if (xMover.IsNull()) { Debug.LogError("xMover " + Time.time); return; } if (xMover == mLoginModule.mRoleID && syncUnit.Type == PosSyncUnit.Types.EMoveType.EmtWalk) { //平常自己行走不需要同步 return; } GameObject xGameObject = mSceneModule.GetObject(xMover); if (!xGameObject) { Debug.LogError("xGameObject " + Time.time); return; } NFHeroMotor xHeroMotor = xGameObject.GetComponent <NFHeroMotor>(); if (!xHeroMotor) { Debug.LogError("xHeroSync " + Time.time); return; } NFHeroSync xHeroSync = xGameObject.GetComponent <NFHeroSync>(); if (!xHeroSync) { Debug.LogError("xHeroSync " + Time.time); return; } UnityEngine.Vector3 v = new UnityEngine.Vector3(); v.x = syncUnit.Pos.X; v.y = syncUnit.Pos.Y; v.z = syncUnit.Pos.Z; if (syncUnit.Type == PosSyncUnit.Types.EMoveType.EmtWalk) { xHeroSync.AddSyncData(xData.Sequence, syncUnit); } else if (syncUnit.Type == PosSyncUnit.Types.EMoveType.EetSpeedy) { xHeroMotor.MoveToImmune(v, 0.1f); } else if (syncUnit.Type == PosSyncUnit.Types.EMoveType.EetTeleport) { xHeroMotor.MoveToImmune(v, 0.001f); } } }