public bool Conform(INPC en) { IClientGlobal cg = SkillSystem.GetClientGlobal(); IEntity player = cg.MainPlayer; ISkillPart skillPart = (ISkillPart)player.GetPart(EntityPart.Skill); SkillDatabase db = skillPart.GetCurSkillDataBase(); if (db != null) { float dis = EntitySystem.EntityHelper.GetEntityDistance(player, en); if (dis <= db.dwAttackDis) { return(true); } } return(false); }
// 进入状态 public override void Enter(object param) { IEntity target = skillPart.GetSkillTarget(); // 只有主角会进入战斗状态 if (skillPart.GetSkillPartType() == SkillPartType.SKILL_PLAYERPART && EntitySystem.EntityHelper.IsMainPlayer(skillPart.GetMaster())) { PlayerSkillPart playerSkill = skillPart as PlayerSkillPart; if (playerSkill != null) { playerSkill.SkillStartPlayTime = Time.realtimeSinceStartup; playerSkill.SetFighting(true); } } SkillDatabase skilltable = skillPart.GetCurSkillDataBase(); if (skilltable == null) { return; } // 朝向目标 if (target != null) { if (skilltable.targetType != (int)SkillTargetType.TargetForwardPoint) { skillPart.GetMaster().SendMessage(EntityMessage.EntityCommand_LookTarget, target.GetPos()); } } database = skilltable; //准备时间结束 发送结束消息 if (SkillSystem.GetClientGlobal().IsMainPlayer(skillPart.GetMaster()) && skilltable.dwReadTime > 0) // 非瞬发技能 { //读条技能 Client.stUninterruptMagic evenparam = new Client.stUninterruptMagic(); evenparam.time = database.dwReadTime; evenparam.type = GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ; evenparam.uid = skillPart.GetMaster().GetUID(); EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSSTART, evenparam); } preparetime = 0; }
public void Execute(GameCmd.stNotifyUninterruptMagicUserCmd_S cmd) { if (cmd.actiontype == UninterruptActionType.UninterruptActionType_SkillCJ) { ISkillPart skillPart = SkillHelper.GetSkillPart(cmd.userid, EntityType.EntityType_Player); if (skillPart == null) { Engine.Utility.Log.Error("获取主角技能部件失败!"); return; } Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSBREAK, new stGuildBreak() { action = GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ, uid = cmd.userid, skillid = skillPart.GetCurSkillDataBase().wdID }); TimerAxis.Instance().KillTimer(m_uReadSliderTimerID, this); skillPart.OnInterruptSkill(cmd.userid, cmd.time, cmd.type, (uint)cmd.actiontype); } else if (cmd.actiontype == UninterruptActionType.UninterruptActionType_GOHOME) { long id = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, cmd.userid); IEntitySystem pEntitySystem = ClientGlobal.Instance().GetEntitySystem(); if (pEntitySystem != null) { IPlayer pPlayer = pEntitySystem.FindPlayer((uint)id); if (pPlayer != null) { if (pPlayer.IsMainPlayer()) { Client.stUninterruptMagic param = new Client.stUninterruptMagic(); param.time = cmd.time; param.type = cmd.actiontype; param.uid = id; param.npcId = cmd.npcid; EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSSTART, param); } else { } } } } else { long id = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, cmd.userid); Client.stUninterruptMagic param = new Client.stUninterruptMagic(); param.time = cmd.time; param.type = cmd.actiontype; param.uid = id; param.npcId = cmd.npcid; EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSSTART, param); } }
public void Execuete(GameCmd.stReturnObjectPosMagicUserCmd_S cmd) { //冲锋应该是goto 瞬移应该是enumMoveType_Immediate 此处待后台修改 前台先山寨一下 if (cmd.byMoveType == stReturnObjectPosMagicUserCmd_S.enumMoveType.enumMoveType_GoTo || cmd.byMoveType == stReturnObjectPosMagicUserCmd_S.enumMoveType.enumMoveType_Immediate) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("GetEntitySystem failed!"); return; } stEntryPosition userPos = cmd.userpos; if (userPos != null) { IEntity player = es.FindEntity <IPlayer>(userPos.dwTempID); if (player != null) { //MapVector2 mapPos = MapVector2.FromCoordinate(userPos.x, userPos.y); Vector3 pos = new Vector3(userPos.cur_pos.x * 0.01f, 0, -userPos.cur_pos.y * 0.01f); // 服务器到客户端坐标转换 ISkillPart skillPart = SkillHelper.GetSkillPart(userPos.dwTempID, EntityType.EntityType_Player); if (skillPart != null) { if (skillPart.IsFastMove()) { Move move = new Move(); move.m_target = pos; move.m_ignoreStand = true; player.SendMessage(EntityMessage.EntityCommand_MoveTo, (object)move); } else { //不是在释放快速移动技能 立刻设置位置 否则延迟设置 player.SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); //Vector3 rot = GameUtil.S2CDirection(userPos.byDir); //player.SendMessage(EntityMessage.EntityCommand_SetRotate, (object)rot); } IEntity skillTarget = skillPart.GetSkillTarget(); if (skillTarget != null && skillTarget.GetUID() != player.GetUID()) { SkillDatabase db = skillPart.GetCurSkillDataBase(); if (db != null) { if (db.targetType == (int)SkillTargetType.TargetForwardPoint) { return; } } player.SendMessage(EntityMessage.EntityCommand_LookTarget, skillTarget.GetPos()); } } } } if (cmd.npcpos != null) { INPC npc = es.FindEntity <INPC>(cmd.npcpos.dwTempID); if (npc != null) { //MapVector2 mapPos = MapVector2.FromCoordinate(cmd.npcpos.x, cmd.npcpos.y); Vector3 pos = new Vector3(cmd.npcpos.cur_pos.x * 0.01f, 0, -cmd.npcpos.cur_pos.y * 0.01f); // 服务器到客户端坐标转换 ISkillPart skillPart = SkillHelper.GetSkillPart(cmd.npcpos.dwTempID, EntityType.EntityType_NPC); if (skillPart != null) { //不是在释放快速移动技能 立刻设置位置 否则延迟设置 npc.SendMessage(EntityMessage.EntityCommand_StopMove, (object)pos); } } } EventEngine.Instance().DispatchEvent((int)GameEventID.CAMERA_MOVE_END); } }
/* * 技能范围 对园和扇形是半径 对于矩形是长 * 技能范围参数 对园和扇形是角度 对于矩形是宽 */ /// <summary> /// /// </summary> /// <param name="en">技能目标</param> /// <returns></returns> public bool Conform(IPlayer en) { if (en == null) { Log.LogGroup("ZDY", " confirm player is null"); return(false); } IClientGlobal cg = SkillSystem.GetClientGlobal(); IEntity player = cg.MainPlayer; ISkillPart skillPart = (ISkillPart)player.GetPart(EntityPart.Skill); SkillDatabase db = skillPart.GetCurSkillDataBase(); Vector3 mytempPos = player.GetPos(); Vector3 targettempPos = en.GetPos(); Vector2 mypos = new Vector2(mytempPos.x, mytempPos.z); Vector2 targetpos = new Vector2(targettempPos.x, targettempPos.z); float dis = EntitySystem.EntityHelper.GetEntityDistance(player, en); if (db != null) { if (db.areaType == 0) { //点 } else if (db.areaType == 1) { //矩形 Log.Error("not implementations "); return(false); } else if (db.areaType == 2) { Transform trans = player.GetTransForm(); if (trans == null) { return(false); } //扇形 Vector2 myDir = new Vector2(trans.forward.x, trans.forward.z); Vector2 dir = targetpos - mypos; float angle = Vector2.Angle(myDir.normalized, dir.normalized); float dbAngle = db.skillAreaParam / 2; if (dbAngle > angle) { if (dis < db.skillArea) { return(true); } } return(false); } else if (db.areaType == 3) { //园 if (dis < db.skillArea) { return(true); } } } return(false); }