void MainUsePanelItemOnClick() { Client.IEntity player = Client.ClientGlobal.Instance().MainPlayer; if (player == null) { return; } bool ismoving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null); if (ismoving) { player.SendMessage(Client.EntityMessage.EntityCommand_StopMove, player.GetPos()); } List <BaseItem> lstItems = DataManager.Manager <ItemManager>().GetItemByBaseId(this.usecommitItemID); if (lstItems.Count > 0) { uint m_nitemThisId = lstItems[0].QWThisID; DataManager.Manager <RideManager>().TryUnRide( (obj) => { Protocol.Instance.RequestUseItem(m_nitemThisId); }, null); } }
public void SetCameraOffset(float fAngleX, float fAngleY, float fDis) { m_fAngleX = fAngleX; m_fAngleY = fAngleY; m_fDis = fDis; // 计算镜头偏移 ClacCameraOffset(); if (m_Target == null) { Engine.Utility.Log.Error("Camera Target is null!"); return; } if (m_Camera == null) { Engine.Utility.Log.Error("Camera is null!"); return; } Vector3 pos = m_Target.GetPos(); m_lastPos = pos; pos.y += m_fYOffset; // 将目标上移 Vector3 camNewPos = pos + m_Offset; m_Camera.LookAt(camNewPos, pos, Vector3.up); if (m_AudioListenerTrans != null && m_Target != null) { m_AudioListenerTrans.position = m_Target.GetPos();// GetNode().GetWorldPosition(); } }
public void OnUpdate(IEntity entity, object param = null) { Client.IEntity mainPlayer = Client.ClientGlobal.Instance().MainPlayer; if (mainPlayer == null || mainPlayer.IsDead() || entity == null) { return; } UnityEngine.Vector3 dis = mainPlayer.GetPos() - entity.GetPos(); uint npcid = (uint)entity.GetProp((int)Client.EntityProp.BaseID); if (npcid != m_nNpcID || SQRMagnitude <= 0f) { m_nNpcID = npcid; table.NpcDataBase npcdb = GameTableManager.Instance.GetTableItem <table.NpcDataBase>(m_nNpcID); if (npcdb != null) { SQRMagnitude = npcdb.dwCallDis * npcdb.dwCallDis * 0.01f * 0.01f; } } if (dis.sqrMagnitude < SQRMagnitude) { if (IsTrigger) { return; } IsTrigger = true; Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.CAMP_ADDCOLLECTNPC, new stCampCollectNpc() { npcid = entity.GetUID(), enter = true }); } else { if (IsTrigger) { Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.CAMP_ADDCOLLECTNPC, new stCampCollectNpc() { npcid = entity.GetUID(), enter = false }); } IsTrigger = false; } }
public void OnUpdate(IEntity entity, object param = null) { if (IsTrigger) { //如果过了2秒还存在 说明没有捡起 if (UnityEngine.Time.realtimeSinceStartup - m_fTriggerTime > 2.5f) { IsTrigger = false; } return; } Client.IEntity mainPlayer = Client.ClientGlobal.Instance().MainPlayer; if (mainPlayer == null || mainPlayer.IsDead() || entity == null) { return; } IBox box = entity as IBox; if (box == null) { return; } UnityEngine.Vector3 dis = mainPlayer.GetPos() - entity.GetPos(); if (dis.sqrMagnitude < SQRMagnitude) { IsTrigger = true; if (box.CanPick()) { m_fTriggerTime = UnityEngine.Time.realtimeSinceStartup; NetService.Instance.Send(new GameCmd.stPickUpItemPropertyUserCmd_C() { qwThisID = entity.GetID() }); // if (box.CanAutoPick()) // { // Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ROBOTCOMBAT_PICKUPITEM, // new Client.stPickUpItem() { itemid = entity.GetID(), state = 1 }); // } // UnityEngine.Debug.Log("捡起道具 " + entity.GetID()); } } }
void MainUsePanelItemOnClick() { Client.IEntity player = Client.ClientGlobal.Instance().MainPlayer; if (player == null) { return; } bool ismoving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null); if (ismoving) { player.SendMessage(Client.EntityMessage.EntityCommand_StopMove, player.GetPos()); } if (curTreasureMap != null) { DataManager.Manager <RideManager>().TryUnRide( (obj) => { VerifyPlayAni(); }, null); } }
public void Update(float dt) { if (m_ClientGlobal.MainPlayer == null) { return; } if (m_enterZoneEvent != null) { Client.IEntity mainPlayer = m_ClientGlobal.MainPlayer; if (mainPlayer != null) { int zoneid = this.IsEnterZone(mainPlayer.GetPos()); if (zoneid != -1) { m_enterZoneEvent(zoneid); } } } // 检测遮挡物 Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem(); if (rs == null) { return; } // 再计算移动速度 Engine.IScene scene = rs.GetActiveScene(); if (scene == null) { return; } scene.CheckOcclusion(m_ClientGlobal.MainPlayer.GetPos()); }
public override void OnEvent(int nEventID, object param) { IEntity casetr = skillPart.GetMaster(); if (casetr == null) { return; } if (nEventID == (int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE) { Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param; if (m_skillDatabase != null && stopEntity.uid == skillPart.GetMaster().GetUID()) { if (m_skillDatabase.dwMoveType == (uint)SkillMoveType.FastMove) // 冲锋类技能 { PlayerSkillPart playerSkill = skillPart as PlayerSkillPart; if (playerSkill != null) { if (playerSkill.gotoPos != Vector3.zero) { playerSkill.Master.SendMessage(EntityMessage.EntityCommand_SetPos, (object)playerSkill.gotoPos); Client.IEntity target = playerSkill.SkillTarget; if (target != null) { if (m_skillDatabase.targetType != (int)SkillTargetType.TargetForwardPoint) { playerSkill.Master.SendMessage(EntityMessage.EntityCommand_LookTarget, target.GetPos()); } } } } m_Statemachine.ChangeState((int)SkillState.Over, null); // 接冲锋动作后半段 //PlayAni anim_param = new PlayAni(); //string strAniName = m_caster.GetAniState().name; //anim_param.strAcionName = strAniName + "_Over"; //anim_param.fSpeed = 1; //anim_param.nStartFrame = 0; //anim_param.nLoop = 1; //anim_param.fBlendTime = 0.2f; //anim_param.aniCallback = OnAnimationPlayEnd; //anim_param.callbackParam = casetr.GetUID(); //// 播放攻击动作 //playerSkill.Player.SendMessage( EntityMessage.EntityCommand_PlayAni , anim_param ); } } } else if (nEventID == (int)Client.GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE) { // 攻击状态中收到移动事件,则切换到OVer状态 } }