private void Absord(long uid, Vector3 pos, Vector3 dir) { float distance = Vector3.Distance(m_thisTransfrom.position, pos); if (distance > m_impactData.m_beatBackSpeed && m_impactData.m_beatBackDuration != 0) { //int v = (int)(distance *m_impactData.m_beatBackAcceleration/m_impactData.m_beatBackDuration*10.0f); int v = (int)(distance / (m_impactData.m_beatBackDuration / 1000.0f)); SMsgBattleBeAdsorb_SC sMsgBattleBeAdsorb_SC = new SMsgBattleBeAdsorb_SC(); sMsgBattleBeAdsorb_SC.uidFighter = uid; sMsgBattleBeAdsorb_SC.PosX = pos.x * 10.0f; sMsgBattleBeAdsorb_SC.PosY = -pos.z * 10.0f; sMsgBattleBeAdsorb_SC.DirX = dir.x; sMsgBattleBeAdsorb_SC.DirY = -dir.z; sMsgBattleBeAdsorb_SC.speed = v * 10; sMsgBattleBeAdsorb_SC.time = (int)(m_impactData.m_beatBackDuration); RaiseEvent(EventTypeEnum.BeAdsorb.ToString(), sMsgBattleBeAdsorb_SC); //send to server SMsgFightAdsorption_CS sMsgFightAdsorption_CS = new SMsgFightAdsorption_CS(); sMsgFightAdsorption_CS.uidFighter = uid; sMsgFightAdsorption_CS.hitedPosX = pos.x * 10.0f; sMsgFightAdsorption_CS.hitedPosY = -pos.z * 10.0f; sMsgFightAdsorption_CS.byType = 1; //NetServiceManager.Instance.BattleService.SendFightAdsorption_CS(sMsgFightAdsorption_CS); adsorbList.Add(sMsgFightAdsorption_CS); } }
public void SetBeAdsorbData(SMsgBattleBeAdsorb_SC dataModel) { m_SMsgBattleBeAdsorb_SC = dataModel; // TraceUtil.Log("dir: x = " + m_SMsgBattleBeAdsorb_SC.DirX + " , y = " + m_SMsgBattleBeAdsorb_SC.DirY); TraceUtil.Log("time = " + m_SMsgBattleBeAdsorb_SC.time); m_adsorbSpeed = m_SMsgBattleBeAdsorb_SC.speed * 0.1f; m_time = m_SMsgBattleBeAdsorb_SC.time * 0.001f; }
public static SMsgAdsorptionContextNum_SC ParseResultPackage(byte[] pkgData) { int offset = 0; int singleContextLength = Marshal.SizeOf(typeof(SMsgBattleBeAdsorb_SC)); SMsgAdsorptionContextNum_SC sMsgAdsorptionContextNum_SC; offset += PackageHelper.ReadData(pkgData.Skip(offset).ToArray(), out sMsgAdsorptionContextNum_SC.byContextNum); sMsgAdsorptionContextNum_SC.list = new List <SMsgBattleBeAdsorb_SC>(); for (int i = 0; i < sMsgAdsorptionContextNum_SC.byContextNum; i++) { SMsgBattleBeAdsorb_SC sMsgBattleBeAdsorb_SC = SMsgBattleBeAdsorb_SC.ParseResultPackage(pkgData.Skip(offset).Take(singleContextLength).ToArray()); sMsgAdsorptionContextNum_SC.list.Add(sMsgBattleBeAdsorb_SC); offset += singleContextLength; } return(sMsgAdsorptionContextNum_SC); }
public void SetBeAdsorbData(SMsgBattleBeAdsorb_SC dataModel) { m_SMsgBattleBeAdsorb_SC = dataModel; }