private void UpdateMoveState(UserInfo playerself, Vector3 targetpos, float towards) { CharacterView view = EntityManager.Instance.GetUserViewById(playerself.GetId()); if (view != null && view.ObjectInfo.IsGfxMoveControl && Geometry.IsSamePoint(Vector3.Zero, targetpos)) { //LogSystem.Debug("UpdateMoveState IsGfxMoveControl : {0} , targetpos : {1}", view.ObjectInfo.IsGfxMoveControl, targetpos.ToString()); return; } PlayerMovement.Motion m = Geometry.IsSamePoint(Vector3.Zero, targetpos) ? PlayerMovement.Motion.Stop : PlayerMovement.Motion.Moving; pm_.JoyStickMotionChanged = pm_.JoyStickMotionStatus != m || !Geometry.IsSameFloat(m_lastDir, towards); pm_.JoyStickMotionStatus = m; pm_.MoveDir = towards; if (Geometry.IsSamePoint(Vector3.Zero, targetpos)) { pm_.JoyStickMotionStatus = PlayerMovement.Motion.Stop; m_IsJoystickControl = false; } else { m_IsJoystickControl = true; } }
private void FindPath(UserInfo playerself, Vector3 targetpos, float towards) { CharacterView view = EntityManager.Instance.GetUserViewById(playerself.GetId()); if (view != null && view.ObjectInfo.IsGfxMoveControl && Vector3.Zero != targetpos) { return; } playerself.GetMovementStateInfo().SetFaceDir(towards); PlayerMovement.Motion m = Vector3.Zero == targetpos ? PlayerMovement.Motion.Stop : PlayerMovement.Motion.Moving; pm_.MotionChanged = pm_.MotionStatus != m || m_lastDir != towards; m_lastDir = towards; pm_.MotionStatus = m; pm_.MoveDir = towards; if (Vector3.Zero == targetpos) { pm_.MotionStatus = PlayerMovement.Motion.Stop; } /* * UserAiStateInfo aiInfo = playerself.GetAiStateInfo(); * if(null == aiInfo) * return; * if (Vector3.Zero == targetpos) { * StopFindPath(playerself, aiInfo); * return; * } * bool ret = (m_lastDir > towards) ? ((m_lastDir - towards) > Math.PI / 4.0f) : ((towards - m_lastDir) > Math.PI / 4.0f); * if (ret) { * StopFindPath(playerself, aiInfo); * m_lastDir = towards; * } * aiInfo.TargetPos = targetpos; * aiInfo.ChangeToState((int)AiStateId.Move); */ }