void ChangeCreatureByBuff(IEntity en, uint buffBaseID, bool isControl) { if (en == null) { return; } BuffDataBase db = GameTableManager.Instance.GetTableItem <BuffDataBase>(buffBaseID); if (db == null) { // Log.Error("找不到Buff{0}的配置数据!", buffBaseID); return; } if (db.buffBigType == (int)BuffBigType.Control && db.buffSmallType == (int)BuffSmallType.XuanYun) { ICreature creature = en as ICreature; if (creature != null) { if (isControl) { creature.ChangeState(CreatureState.Contrl); } else { creature.ChangeState(CreatureState.Normal); } } } }
private void Move(bool bPath = false) { if (m_Owner == null) { return; } Vector3 pos = m_Owner.GetPos(); //如果目标是当前位置 if (pos.x == m_param.m_target.x && pos.z == m_param.m_target.z) { StopMove(m_param.m_target); return; } // 获取服务器时间 if (EntitySystem.m_ClientGlobal.IsMainPlayer(m_Owner)) { m_uServerTime = EntityConfig.serverTime; } pos.y = 0.0f; if (m_hasTarget) { if (!bPath) { if (m_param.path == null) { m_param.path = new List <Vector3>(); } else { m_param.path.Clear(); } m_param.path.Add(pos); m_param.path.Add(m_param.m_target); } } else { if (!bPath) { if (m_param.path == null) { m_param.path = new List <Vector3>(); } else { m_param.path.Clear(); } m_param.path.Add(pos); // 起始点 Vector3 target = pos + m_param.m_target; m_param.path.Add(target); } } if (m_param.path == null) { return; } if (m_param.path.Count <= 0) { return; } // 开始移动事件 先发事件再处理 stEntityBeginMove move = new stEntityBeginMove(); move.uid = m_Owner.GetUID(); Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE, move); //开始移动时也同步下位置 //SyncPos(true); // 路径点切换 m_nPathIndex = 0; m_target = pos; if (pos.Equals(m_param.path[m_nPathIndex])) // 去除第一个点 { m_nPathIndex++; if (m_nPathIndex >= m_param.path.Count) { return; } } m_lastWalkPos = pos; m_fDistance = 0.0f; // 切换目标点 SwitchTarget(m_param.path[m_nPathIndex], ref pos); // 贴地处理 CloseTerrainPos(ref pos); m_vLastPos = pos; m_lastSyncPos = m_vLastPos; m_bMoving = true; if (!m_bIgnoreMoveAction) { m_Owner.PlayAction(m_param.strRunAct, 0, m_fSpeedFact); } if (m_LastTime == 0) { m_LastTime = Engine.Utility.TimeHelper.GetTickCount(); } m_BeginTime = m_LastTime; //Engine.Utility.Log.Error("Move begine: ({0},{1})->({3},{4}) {2} ", pos.x, pos.z, m_BeginTime, m_param.path[m_param.path.Count - 1].x, m_param.path[m_param.path.Count - 1].z); // 进入move状态 ICreature owner = m_Owner as ICreature; if (owner != null) { owner.ChangeState(CreatureState.Move); } }