public override void DoBeforeLeaving() { m_PlayerBehaviour.Invincible = false; m_PlayerBehaviour.IronBody = false; m_skillBase.RemoveActionDelegate(ActionHandler); m_skillBase.DeleteSkillOverDelegate(SkillOverHandler); m_skillBase.BreakSkill(); /*if (m_skillCamera != null) * m_skillCamera.GetComponent<SkillCamera>().OnDestroy();*/ //技能结束,必须保证角色显身 m_PlayerBehaviour.ChangeDisplayState(1); //m_PlayerBehaviour.ChangeDisplayState(1); if (GameManager.Instance.CurrentGameMode == GameMode.SINGLE_PLAYER) { float xValue, yValue; this.m_PlayerBehaviour.ThisTransform.position.SetToServer(out xValue, out yValue); SMsgFightCommand_CS sMsgFightCommand_CS = new SMsgFightCommand_CS(); sMsgFightCommand_CS.uidFighter = this.m_PlayerBehaviour.RoleDataModel.SMsg_Header.uidEntity; sMsgFightCommand_CS.nFightCode = m_skillBase.SkillId; sMsgFightCommand_CS.byType = 0; sMsgFightCommand_CS.fighterPosX = xValue; sMsgFightCommand_CS.fighterPosY = yValue; NetServiceManager.Instance.BattleService.SendFightCommandCS(sMsgFightCommand_CS); } base.DoBeforeLeaving(); }
public override void DoBeforeLeaving() { m_MonsterBehaviour.Invincible = false; m_MonsterBehaviour.IronBody = false; if (m_currentSkillBase != null) { m_currentSkillBase.RemoveActionDelegate(ActionHandle); m_currentSkillBase.RemoveSkillBulletFireDelegate(FireBulletHandle); m_currentSkillBase.RemoveSkillEffectFireDelegate(FireSkillActionEffect); m_currentSkillBase.DeleteSkillOverDelegate(ActionOverHandle); m_currentSkillBase.BreakSkill(); } //保证显身 if (GameManager.Instance.CurrentGameMode == GameMode.SINGLE_PLAYER) { float xValue, yValue; this.m_MonsterBehaviour.ThisTransform.position.SetToServer(out xValue, out yValue); SMsgFightCommand_CS sMsgFightCommand_CS = new SMsgFightCommand_CS(); sMsgFightCommand_CS.uidFighter = this.m_MonsterBehaviour.RoleDataModel.SMsg_Header.uidEntity; sMsgFightCommand_CS.nFightCode = m_currentSkillBase.SkillId; sMsgFightCommand_CS.byType = 0; sMsgFightCommand_CS.fighterPosX = xValue; sMsgFightCommand_CS.fighterPosY = yValue; NetServiceManager.Instance.BattleService.SendFightCommandCS(sMsgFightCommand_CS); } m_MonsterBehaviour.ChangeDisplayState(1); base.DoBeforeLeaving(); }
private void SendNormalSkillCommand(int skillId) { Int64 targetEntityId = 0; //if (m_skillBase.SkillData.IsLockTarget) //20141008 技能细节修改。动作的followType=1 为跟随目标的动作不再有用,而技能的AutoDirecting判断 if (m_skillBase.SkillData.AutoDirecting) { //计算锁定目标,保存在PlayerBehaviour一个变量,并把目标发给服务器端 //2014-10-09 普通攻击的锁定目标计算规则有修改 //var targetEntityModel = LockAttackMonster(this.m_attackDistance, this.m_attackAngle); var targetEntityModel = MonsterManager.Instance.LockedMonster; if (targetEntityModel != null) { m_PlayerBehaviour.ActionLockTarget = targetEntityModel; targetEntityId = targetEntityModel.EntityDataStruct.SMsg_Header.uidEntity; m_PlayerBehaviour.ThisTransform.LookAt(new Vector3(targetEntityModel.GO.transform.position.x, m_PlayerBehaviour.ThisTransform.position.y, targetEntityModel.GO.transform.position.z)); } } float xValue, yValue; this.m_PlayerBehaviour.ThisTransform.position.SetToServer(out xValue, out yValue); if (GameManager.Instance.CurrentGameMode == GameMode.MULTI_PLAYER) { SMsgBattleCommand sMsgBattleCommand = new SMsgBattleCommand(); sMsgBattleCommand.uidFighter = this.m_PlayerBehaviour.RoleDataModel.SMsg_Header.uidEntity; sMsgBattleCommand.uidTarget = targetEntityId; sMsgBattleCommand.nFightCode = skillId; sMsgBattleCommand.xPlayer = xValue; sMsgBattleCommand.yPlayer = yValue; sMsgBattleCommand.xMouse = xValue; sMsgBattleCommand.yMouse = yValue; //var dire = this.m_PlayerBehaviour.ThisTransform.TransformDirection(this.m_PlayerBehaviour.ThisTransform.forward); var euler = this.m_PlayerBehaviour.ThisTransform.rotation.eulerAngles; var d = Quaternion.Euler(euler) * Vector3.forward; sMsgBattleCommand.xDirect = d.x; sMsgBattleCommand.yDirect = d.z * -1; //add by lee sMsgBattleCommand.bulletIndex = (UInt32)BulletManager.Instance.ReadIndex(this.m_PlayerBehaviour.RoleDataModel.SMsg_Header.uidEntity); NetServiceManager.Instance.BattleService.SendBattleCommand(sMsgBattleCommand); } else if (GameManager.Instance.CurrentGameMode == GameMode.SINGLE_PLAYER) { SMsgFightCommand_CS sMsgFightCommand_CS = new SMsgFightCommand_CS(); sMsgFightCommand_CS.uidFighter = this.m_PlayerBehaviour.RoleDataModel.SMsg_Header.uidEntity; sMsgFightCommand_CS.nFightCode = skillId; sMsgFightCommand_CS.byType = 1; sMsgFightCommand_CS.fighterPosX = xValue; sMsgFightCommand_CS.fighterPosY = yValue; NetServiceManager.Instance.BattleService.SendFightCommandCS(sMsgFightCommand_CS); } }
public override void DoBeforeEntering() { //m_MonsterBehaviour.ClientEndPos.Value = null; m_currentSkillBase = this.m_MonsterBehaviour.m_SkillBaseList.FirstOrDefault(p => p.SkillId == m_currentSkillID); if (m_currentSkillBase == null) { TraceUtil.Log(SystemModel.Common, TraceLevel.Error, "找不到相关技能"); TraceUtil.Log(SystemModel.NotFoundInTheDictionary, TraceLevel.Error, "找不到相关技能"); } else { m_currentSkillBase.AddActionDelegate(ActionHandle); m_currentSkillBase.AddSkillBulletFireDelegate(FireBulletHandle); m_currentSkillBase.AddSkillEffectFireDelegate(FireSkillActionEffect); m_currentSkillBase.AddSkillOverDelegate(ActionOverHandle); m_currentSkillBase.Fire(); } if (Vector3.Distance(m_MonsterBehaviour.ThisTransform.position, m_shouldPos) >= 10) { //相差太大的情况: m_MonsterBehaviour.MoveToPoint(m_shouldPos); } else { m_MonsterBehaviour.MoveToPoint(m_shouldPos); } m_MonsterBehaviour.ThisTransform.LookAt(new Vector3(m_attackLookAtPos.x, m_MonsterBehaviour.ThisTransform.position.y, m_attackLookAtPos.z)); //清零位移 m_displacement = 0; //清除路点信息 m_MonsterBehaviour.PointQueue.Clear(); if (GameManager.Instance.CurrentGameMode == GameMode.SINGLE_PLAYER) { float xValue, yValue; this.m_MonsterBehaviour.ThisTransform.position.SetToServer(out xValue, out yValue); SMsgFightCommand_CS sMsgFightCommand_CS = new SMsgFightCommand_CS(); sMsgFightCommand_CS.uidFighter = this.m_MonsterBehaviour.RoleDataModel.SMsg_Header.uidEntity; sMsgFightCommand_CS.nFightCode = m_currentSkillBase.SkillId; sMsgFightCommand_CS.byType = 1; sMsgFightCommand_CS.fighterPosX = xValue; sMsgFightCommand_CS.fighterPosY = yValue; NetServiceManager.Instance.BattleService.SendFightCommandCS(sMsgFightCommand_CS); } m_MonsterBehaviour.FixMonsterYToOrigin(); base.DoBeforeEntering(); }
void SkillOverHandler() { if (GameManager.Instance.CurrentGameMode == GameMode.SINGLE_PLAYER) { float xValue, yValue; this.m_PlayerBehaviour.ThisTransform.position.SetToServer(out xValue, out yValue); SMsgFightCommand_CS sMsgFightCommand_CS = new SMsgFightCommand_CS(); sMsgFightCommand_CS.uidFighter = this.m_PlayerBehaviour.RoleDataModel.SMsg_Header.uidEntity; sMsgFightCommand_CS.nFightCode = m_skillBase.SkillId; sMsgFightCommand_CS.byType = 0; sMsgFightCommand_CS.fighterPosX = xValue; sMsgFightCommand_CS.fighterPosY = yValue; NetServiceManager.Instance.BattleService.SendFightCommandCS(sMsgFightCommand_CS); } if (m_sirenSkillList.Count <= 0) { OnChangeTransition(Transition.PlayerToIdle); return; } //m_skillBase.RemoveActionDelegate(ActionHandler); //m_skillBase.DeleteSkillOverDelegate(SkillOverHandler); //SirenSkill sirenSkill = m_sirenSkillList[0]; //m_sirenSkillList.RemoveAt(0); //this.m_PlayerBehaviour.GetSkillBySkillID(sirenSkill._SkillID); //m_skillBase = this.m_PlayerBehaviour.SelectedSkillBase; //m_skillBase.AddActionDelegate(ActionHandler); //m_skillBase.AddSkillOverDelegate(SkillOverHandler); //if (this.m_PlayerBehaviour.IsHero) //{ // SendNormalSkillCommand(m_skillBase.SkillId); //} //m_skillBase.Fire(); ////UI特效 //var uiEffectGroups = m_skillBase.SkillData.m_UIEffectGroupList; //if (uiEffectGroups.Count > 0) //{ // m_delayCreateUIEffectTime = uiEffectGroups[0]._EffectStartTime; // m_isCreateUIEffect = true; //} }
private void SendNormalSkillCommand(int skillId) { float xValue, yValue; this.m_PlayerBehaviour.ThisTransform.position.SetToServer(out xValue, out yValue); if (GameManager.Instance.CurrentGameMode == GameMode.MULTI_PLAYER) { SMsgBattleCommand sMsgBattleCommand = new SMsgBattleCommand(); sMsgBattleCommand.uidFighter = this.m_PlayerBehaviour.RoleDataModel.SMsg_Header.uidEntity; sMsgBattleCommand.nFightCode = skillId; sMsgBattleCommand.xPlayer = xValue; sMsgBattleCommand.yPlayer = yValue; sMsgBattleCommand.xMouse = xValue; sMsgBattleCommand.yMouse = yValue; //var dire = this.m_PlayerBehaviour.ThisTransform.TransformDirection(this.m_PlayerBehaviour.ThisTransform.forward); var euler = this.m_PlayerBehaviour.ThisTransform.rotation.eulerAngles; var d = Quaternion.Euler(euler) * Vector3.forward; sMsgBattleCommand.xDirect = d.x; sMsgBattleCommand.yDirect = d.z * -1; //add by lee sMsgBattleCommand.bulletIndex = (UInt32)BulletManager.Instance.ReadIndex(this.m_PlayerBehaviour.RoleDataModel.SMsg_Header.uidEntity); NetServiceManager.Instance.BattleService.SendBattleCommand(sMsgBattleCommand); } else if (GameManager.Instance.CurrentGameMode == GameMode.SINGLE_PLAYER) { SMsgFightCommand_CS sMsgFightCommand_CS = new SMsgFightCommand_CS(); sMsgFightCommand_CS.uidFighter = this.m_PlayerBehaviour.RoleDataModel.SMsg_Header.uidEntity; sMsgFightCommand_CS.nFightCode = skillId; sMsgFightCommand_CS.byType = 1; sMsgFightCommand_CS.fighterPosX = xValue; sMsgFightCommand_CS.fighterPosY = yValue; NetServiceManager.Instance.BattleService.SendFightCommandCS(sMsgFightCommand_CS); } }
public override void DoBeforeLeaving() { m_PlayerBehaviour.Invincible = false; m_PlayerBehaviour.IronBody = false; m_skillBase.RemoveActionDelegate(ActionHandler); m_skillBase.DeleteSkillOverDelegate(SkillOverHandler); IsSkillBeBreaked = true; m_skillBase.BreakSkill(); if (GameManager.Instance.CurrentGameMode == GameMode.SINGLE_PLAYER) { float xValue, yValue; this.m_PlayerBehaviour.ThisTransform.position.SetToServer(out xValue, out yValue); SMsgFightCommand_CS sMsgFightCommand_CS = new SMsgFightCommand_CS(); sMsgFightCommand_CS.uidFighter = this.m_PlayerBehaviour.RoleDataModel.SMsg_Header.uidEntity; sMsgFightCommand_CS.nFightCode = m_skillBase.SkillId; sMsgFightCommand_CS.byType = 0; sMsgFightCommand_CS.fighterPosX = xValue; sMsgFightCommand_CS.fighterPosY = yValue; NetServiceManager.Instance.BattleService.SendFightCommandCS(sMsgFightCommand_CS); } base.DoBeforeLeaving(); }
public void SendFightCommandCS(SMsgFightCommand_CS sMsgFightCommand_CS) { this.Request(sMsgFightCommand_CS.GeneratePackage()); }
public void SkillOverHandler() { if (!PlayerManager.Instance.NormalAttackRemembering) { m_PlayerBehaviour.NormalAttackButtonPress = false; } if (GameManager.Instance.CurrentGameMode == GameMode.SINGLE_PLAYER) { float xValue, yValue; this.m_PlayerBehaviour.ThisTransform.position.SetToServer(out xValue, out yValue); SMsgFightCommand_CS sMsgFightCommand_CS = new SMsgFightCommand_CS(); sMsgFightCommand_CS.uidFighter = this.m_PlayerBehaviour.RoleDataModel.SMsg_Header.uidEntity; sMsgFightCommand_CS.nFightCode = m_skillBase.SkillId; sMsgFightCommand_CS.byType = 0; sMsgFightCommand_CS.fighterPosX = xValue; sMsgFightCommand_CS.fighterPosY = yValue; NetServiceManager.Instance.BattleService.SendFightCommandCS(sMsgFightCommand_CS); } if (!GameManager.Instance.UseJoyStick) { if (m_PlayerBehaviour.LastWalkToPosition != null) { m_PlayerBehaviour.WalkToPosition = m_PlayerBehaviour.LastWalkToPosition; IsSkillBeBreaked = true; m_normalAttackStep++; if (m_normalAttackStep > 5) { m_normalAttackStep = 0; } OnChangeTransition(Transition.PlayerToTarget); return; } } else { if (!m_PlayerBehaviour.NormalAttackButtonPress) { IsSkillBeBreaked = true; m_normalAttackStep++; if (m_normalAttackStep > 5) { m_normalAttackStep = 0; } OnChangeTransition(Transition.PlayerToIdle); return; } } if (m_normalAttackStep == 5) { m_normalAttackStep = 0; IsSkillBeBreaked = true; if (!GameManager.Instance.UseJoyStick) { m_PlayerBehaviour.WalkToPosition = m_PlayerBehaviour.ThisTransform.TransformPoint(Vector3.forward); OnChangeTransition(Transition.PlayerToTarget); } else { OnChangeTransition(Transition.PlayerToIdle); } return; } m_normalAttackStep++; SelectNormalSkill(); if (this.m_PlayerBehaviour.IsHero) { SendNormalSkillCommand(m_skillBase.SkillId); } if (GameManager.Instance.UseJoyStick) { if (m_PlayerBehaviour.IsJoyStickPress && m_PlayerBehaviour.JoyStickDir != Vector3.zero) { Vector3 lootToPos = m_PlayerBehaviour.ThisTransform.position + m_PlayerBehaviour.JoyStickDir; m_PlayerBehaviour.ChangeForward(lootToPos); } } m_skillBase.Fire(); m_PlayerBehaviour.ClientMove = false; }
private void SendNormalSkillCommand(int skillId) { Int64 targetEntityId = 0; if (m_skillBase.SkillData.IsLockTarget) { //计算锁定目标,保存在PlayerBehaviour一个变量,并把目标发给服务器端 var targetEntityModel = LockAttackMonster(this.m_attackDistance, this.m_attackAngle); if (targetEntityModel != null) { m_PlayerBehaviour.ActionLockTarget = targetEntityModel; targetEntityId = targetEntityModel.EntityDataStruct.SMsg_Header.uidEntity; } } float xValue, yValue; this.m_PlayerBehaviour.ThisTransform.position.SetToServer(out xValue, out yValue); if (GameManager.Instance.CurrentGameMode == GameMode.MULTI_PLAYER) { SMsgBattleCommand sMsgBattleCommand = new SMsgBattleCommand(); sMsgBattleCommand.uidFighter = this.m_PlayerBehaviour.RoleDataModel.SMsg_Header.uidEntity; sMsgBattleCommand.uidTarget = targetEntityId; sMsgBattleCommand.nFightCode = skillId; float xFireValue, yFireValue; if (2 == m_skillBase.SkillData.m_directionParam) { this.m_PlayerBehaviour.SkillFirePos.SetToServer(out xFireValue, out yFireValue); } else { this.m_PlayerBehaviour.ThisTransform.position.SetToServer(out xFireValue, out yFireValue); } sMsgBattleCommand.xPlayer = xValue; sMsgBattleCommand.yPlayer = yValue; sMsgBattleCommand.xMouse = xFireValue; sMsgBattleCommand.yMouse = yFireValue; var euler = this.m_PlayerBehaviour.ThisTransform.rotation.eulerAngles; var d = Quaternion.Euler(euler) * Vector3.forward; sMsgBattleCommand.xDirect = d.x; sMsgBattleCommand.yDirect = d.z * -1; //add by lee sMsgBattleCommand.bulletIndex = (UInt32)BulletManager.Instance.ReadIndex(this.m_PlayerBehaviour.RoleDataModel.SMsg_Header.uidEntity); NetServiceManager.Instance.BattleService.SendBattleCommand(sMsgBattleCommand); } else if (GameManager.Instance.CurrentGameMode == GameMode.SINGLE_PLAYER) { SMsgFightCommand_CS sMsgFightCommand_CS = new SMsgFightCommand_CS(); sMsgFightCommand_CS.uidFighter = this.m_PlayerBehaviour.RoleDataModel.SMsg_Header.uidEntity; sMsgFightCommand_CS.nFightCode = skillId; sMsgFightCommand_CS.byType = 1; sMsgFightCommand_CS.fighterPosX = xValue; sMsgFightCommand_CS.fighterPosY = yValue; NetServiceManager.Instance.BattleService.SendFightCommandCS(sMsgFightCommand_CS); } //\edit by lee //SMsgActionClientOptMove_CS sMsgActionClientOptMove = new SMsgActionClientOptMove_CS(); //sMsgActionClientOptMove.dwMapID = GameManager.Instance.GetCurSceneMapID; //sMsgActionClientOptMove.dwPathLen = 1; //NetServiceManager.Instance.BattleService.SendClientOptMoveCommand(sMsgActionClientOptMove); }