/// <summary> /// 获取位置 /// </summary> /// <param name="posType">位置类型</param> /// <param name="paramsPacker">数据包装类</param> /// <param name="scope">数据域</param> /// <returns></returns> public static Vector3 GetPosByType(int posType, FormulaParamsPacker paramsPacker, DataScope scope) { // 获取目标位置 var posX = 0f; var posY = 0f; var height = paramsPacker.ReleaseMember.ClusterData.Height; switch (posType) { case 0: { posX = paramsPacker.ReleaseMember.ClusterData.X; posY = paramsPacker.ReleaseMember.ClusterData.Y; } break; case 1: { posX = paramsPacker.ReceiverMenber.ClusterData.X; posY = paramsPacker.ReceiverMenber.ClusterData.Y; height = paramsPacker.ReceiverMenber.ClusterData.Height; } break; case 2: { posX = scope.GetFloat(Utils.TargetPointSelectorXKey) ?? 0f; posY = scope.GetFloat(Utils.TargetPointSelectorYKey) ?? 0f; } break; } var pos = new Vector3(posX, height, posY); return(pos); }
/// <summary> /// 检测当前buff中的数据, 如果数据符合Detach条件返回true /// TODO 检测效率 /// </summary> /// <returns>是否符合Detach条件</returns> public bool CheckDetach() { var result = false; // 检测条件 for (var i = 0; i < DetachQualifiedKeyList.Count; i++) { var key = DetachQualifiedKeyList[i]; var op = DetachQualifiedOptionList[i]; var value = DetachQualifiedValueList[i]; // 判断类型 if (value.IndexOf("f", StringComparison.Ordinal) > 0) { // float result = Utils.GetCompare <float>(op)(DataScope.GetFloat(key).Value, Convert.ToSingle(value.Replace("f", ""))); } else if (value.EndsWith("L")) { // long result = Utils.GetCompare <long>(op)(DataScope.GetLong(key).Value, Convert.ToInt64(value)); } else if (value.Equals("true") && value.Equals("false")) { // bool result = Utils.GetCompare <bool>(op)(DataScope.GetBool(key).Value, Convert.ToBoolean(value)); } else { // int result = Utils.GetCompare <int>(op)(DataScope.GetInt(key).Value, Convert.ToInt32(value)); } } return(result); }