public override int GetHashCode() { int result = 7057; result = result * 8171 + InternalFlags; result = result * 8171 + DontObstructDistance.GetHashCode(); result = result * 8171 + DontPlayDistance.GetHashCode(); result = result * 8171 + AttackDistance.GetHashCode(); result = result * 8171 + MinDistance.GetHashCode(); result = result * 8171 + SustainBeginDistance.GetHashCode(); result = result * 8171 + SustainEndDistance.GetHashCode(); result = result * 8171 + MaxDistance.GetHashCode(); result = result * 8171 + SustainDB.GetHashCode(); result = result * 8171 + SkipFraction.GetHashCode(); result = result * 8171 + MaxPendPerSec.GetHashCode(); result = result * 8171 + GainBase.GetHashCode(); result = result * 8171 + GainVariance.GetHashCode(); result = result * 8171 + RandomPitchBoundsMin; result = result * 8171 + RandomPitchBoundsMax; result = result * 8171 + InnerConeAngle.GetHashCode(); result = result * 8171 + OuterConeAngle.GetHashCode(); result = result * 8171 + OuterConeGain.GetHashCode(); result = result * 8171 + Flags; result = result * 8171 + Azimuth.GetHashCode(); result = result * 8171 + PositionalGain.GetHashCode(); result = result * 8171 + FirstPersonGain.GetHashCode(); return(result); }
public override string GetDisplayName(bool isAddingNew) { string displayName = "Nearby Monsters"; if (!isAddingNew) { displayName += " ["; displayName += ("Types="); if (CountWhiteMonsters) { displayName += ("White,"); } if (CountRareMonsters) { displayName += ("Rare,"); } if (CountMagicMonsters) { displayName += ("Magic,"); } if (CountUniqueMonsters) { displayName += ("Unique"); } displayName += ("MaxDistance=" + MaxDistance.ToString()); if (ColdResistanceThreshold > 0 || FireResistanceThreshold > 0 || LightningResistanceThreshold > 0 || ChaosResistanceThreshold > 0) { displayName += ("Resist restrictions"); } displayName += "]"; } return(displayName); }
public Dictionary <string, object> GetCustomFilterList() { filterList = GetFilterList(); if (AddressLat != null) { filterList.Add("@AddressLat", AddressLat.ToString()); } if (AddressLong != null) { filterList.Add("@AddressLong", AddressLong.ToString()); } if (MinDistance != null) { filterList.Add("@MinDistance", MinDistance.ToString()); } if (MaxDistance != null) { filterList.Add("@MaxDistance", MaxDistance.ToString()); } if (OpenHouse != null) { filterList.Add("@OpenHouse", OpenHouse.ToString()); } if (!String.IsNullOrWhiteSpace(SearchText)) { filterList.Add("@SearchText", SearchText); } if (!String.IsNullOrWhiteSpace(FilterPropertyType)) { filterList.Add("@FilterPropertyType", FilterPropertyType); } if (FilterListPriceMin.HasValue) { filterList.Add("@FilterListPriceMin", FilterListPriceMin); } if (FilterListPriceMax.HasValue) { filterList.Add("@FilterListPriceMax", FilterListPriceMax); } if (FilterBeginDate.HasValue) { filterList.Add("@FilterBeginDate", FilterBeginDate); } if (FilterEndDate.HasValue) { filterList.Add("@FilterEndDate", FilterEndDate); } if (NewHomesOnly.HasValue) { filterList.Add("@NewHomesOnly", NewHomesOnly); } if (ShowLotsLand.HasValue) { filterList.Add("@ShowLotsLand", ShowLotsLand); } return(filterList); }
public string Serialize() { if (MaxDistance.IsEqual(0, 0.1)) { return(null); } var epd = new ElevationProfileData(); return(JsonConvert.SerializeObject(this)); }
public void Should_Pass_Cases(int[] input, int expected) { // Arrange var obj = new MaxDistance(); // Act var actual = obj.maximumGap(input.ToList()); // Assert actual.Should().Be(expected); }
public override int GetHashCode() { int result = 7057; result = result * 8171 + DontObstructDistance.GetHashCode(); result = result * 8171 + DontPlayDistance.GetHashCode(); result = result * 8171 + AttackDistance.GetHashCode(); result = result * 8171 + MinDistance.GetHashCode(); result = result * 8171 + SustainBeginDistance.GetHashCode(); result = result * 8171 + SustainEndDistance.GetHashCode(); result = result * 8171 + MaxDistance.GetHashCode(); result = result * 8171 + SustainDB.GetHashCode(); return(result); }
static void Main() { char[] test1 = { 'g', 'b', 'c', 'j', 'b', 'd', 'h', 'a' }; char[] test2 = { 'z', 'x', 'y' }; char[] test3 = {}; char[] test4 = { 'x', 'z' }; char[] test5 = { 'x', '@', 'z' }; char[] test6 = null; char[] test7 = { 'g', 'B', 'c', 'J', 'B', 'd', 'h', 'a' }; char[] test8 = { 'z', 'b', 'c', 'a', 'd' }; MaxDistance maxDist = new MaxDistance(); Console.WriteLine(maxDist.getMaxDistance(test1)); Console.WriteLine(maxDist.getMaxDistance(test2)); Console.WriteLine(maxDist.getMaxDistance(test3)); Console.WriteLine(maxDist.getMaxDistance(test4)); Console.WriteLine(maxDist.getMaxDistance(test5)); Console.WriteLine(maxDist.getMaxDistance(test6)); Console.WriteLine(maxDist.getMaxDistance(test7)); Console.WriteLine(maxDist.getMaxDistance(test8)); }
public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters) { ImGui.TextDisabled("Condition Info"); ImGuiExtension.ToolTipWithText("(?)", "This condition will return true if any of the selected player's resistances\nare reduced by more than or equal to the specified amount.\nReduced max resistance modifiers are taken into effect automatically (e.g. -res map mods)."); base.CreateConfigurationMenu(extensionParameter, ref Parameters); MinimumMonsterCount = ImGuiExtension.IntSlider("Minimum Monster Count", MinimumMonsterCount, 1, 50); Parameters[MinimumMonsterCountString] = MinimumMonsterCount.ToString(); MaxDistance = ImGuiExtension.FloatSlider("Maximum Distance", MaxDistance, 1.0f, 5000.0f); Parameters[MaxDistanceString] = MaxDistance.ToString(); PreviewDistance = ImGuiExtension.Checkbox("Preview distance", PreviewDistance); if (PreviewDistance) { //extensionParameter.Plugin.PlayerHelper.DrawSquareToWorld(extensionParameter.Plugin.GameController.Player.Pos, MaxDistance); } ImGui.Spacing(); ImGui.Separator(); ImGui.Spacing(); ColdResistanceThreshold = ImGuiExtension.IntSlider("Cold Resist Above", ColdResistanceThreshold, 0, 75); Parameters[ColdResistanceThresholdString] = ColdResistanceThreshold.ToString(); FireResistanceThreshold = ImGuiExtension.IntSlider("Fire Resist Above", FireResistanceThreshold, 0, 75); Parameters[FireResistanceThresholdString] = FireResistanceThreshold.ToString(); LightningResistanceThreshold = ImGuiExtension.IntSlider("Lightning Resist Above", LightningResistanceThreshold, 0, 75); Parameters[LightningResistanceThresholdString] = LightningResistanceThreshold.ToString(); ChaosResistanceThreshold = ImGuiExtension.IntSlider("Chaos Resist Above", ChaosResistanceThreshold, 0, 75); Parameters[ChaosResistanceThresholdString] = ChaosResistanceThreshold.ToString(); ImGui.Spacing(); ImGui.Separator(); ImGui.Spacing(); CountWhiteMonsters = ImGuiExtension.Checkbox("White Monsters", CountWhiteMonsters); Parameters[CountWhiteMonstersString] = CountWhiteMonsters.ToString(); CountRareMonsters = ImGuiExtension.Checkbox("Rare Monsters", CountRareMonsters); Parameters[CountRareMonstersString] = CountRareMonsters.ToString(); CountMagicMonsters = ImGuiExtension.Checkbox("Magic Monsters", CountMagicMonsters); Parameters[CountMagicMonstersString] = CountMagicMonsters.ToString(); CountUniqueMonsters = ImGuiExtension.Checkbox("Unique Monsters", CountUniqueMonsters); Parameters[CountUniqueMonstersString] = CountUniqueMonsters.ToString(); ImGui.Spacing(); ImGui.Separator(); ImGui.Spacing(); MonsterHealthPercentThreshold = ImGuiExtension.IntSlider("Monster Health Percent", MonsterHealthPercentThreshold, 0, 100); Parameters[MonsterHealthPercentThresholdString] = MonsterHealthPercentThreshold.ToString(); MonsterAboveHealthThreshold = ImGuiExtension.Checkbox("Above Health Threshold", MonsterAboveHealthThreshold); Parameters[MonsterAboveHealthThresholdString] = MonsterAboveHealthThreshold.ToString(); return(true); }
public override int GetHashCode() { int hash = 1; if (MaxDistanceValid != false) { hash ^= MaxDistanceValid.GetHashCode(); } if (SensorIdValid != false) { hash ^= SensorIdValid.GetHashCode(); } if (RadarPowerValid != false) { hash ^= RadarPowerValid.GetHashCode(); } if (OutputTypeValid != false) { hash ^= OutputTypeValid.GetHashCode(); } if (SendQualityValid != false) { hash ^= SendQualityValid.GetHashCode(); } if (SendExtInfoValid != false) { hash ^= SendExtInfoValid.GetHashCode(); } if (SortIndexValid != false) { hash ^= SortIndexValid.GetHashCode(); } if (StoreInNvmValid != false) { hash ^= StoreInNvmValid.GetHashCode(); } if (CtrlRelayValid != false) { hash ^= CtrlRelayValid.GetHashCode(); } if (RcsThresholdValid != false) { hash ^= RcsThresholdValid.GetHashCode(); } if (MaxDistance != 0) { hash ^= MaxDistance.GetHashCode(); } if (SensorId != 0) { hash ^= SensorId.GetHashCode(); } if (OutputType != 0) { hash ^= OutputType.GetHashCode(); } if (RadarPower != 0) { hash ^= RadarPower.GetHashCode(); } if (CtrlRelay != 0) { hash ^= CtrlRelay.GetHashCode(); } if (SendExtInfo != false) { hash ^= SendExtInfo.GetHashCode(); } if (SendQuality != false) { hash ^= SendQuality.GetHashCode(); } if (SortIndex != 0) { hash ^= SortIndex.GetHashCode(); } if (StoreInNvm != 0) { hash ^= StoreInNvm.GetHashCode(); } if (RcsThreshold != 0) { hash ^= RcsThreshold.GetHashCode(); } if (InputSendInterval != 0UL) { hash ^= InputSendInterval.GetHashCode(); } return(hash); }
public void WhenInputArrayWithMaxDistance5_Calcule_ThenReturn5() { var actual = new MaxDistance().Calculate(new[] { 0, 3, 3, 12, 5, 3, 7, 1 }); Assert.AreEqual(5, actual); }
public void WhenInputArrayHasAllNegativeNumbers_Calcule_ThenReturnMinus2() { var actual = new MaxDistance().Calculate(new[] { -5, -5, -5 }); Assert.AreEqual(-2, actual); }
public void WhenInputArrayWithMaxDistance10_Calcule_ThenReturn10() { var actual = new MaxDistance().Calculate(new[] { -3, -5, 8, -2, 12 }); Assert.AreEqual(10, actual); }
public void WhenInputArrayWithMaxDistance82_Calcule_ThenReturn82() { var actual = new MaxDistance().Calculate(new[] { 1, 1, 4, 17, 99 }); Assert.AreEqual(82, actual); }
public void WhenInputArrayWithMaxDistance4_Calcule_ThenReturn4() { var actual = new MaxDistance().Calculate(new[] { 1, 1, 4, 5, 8, 2, 12 }); Assert.AreEqual(4, actual); }
/// <summary> /// Creates a JSON string that represents the motor's serialized state. We /// do this since Unity can't handle putting lists of derived objects into /// prefabs. /// </summary> /// <returns>JSON string representing the object</returns> public virtual string SerializeMotor() { if (_Type.Length == 0) { _Type = this.GetType().AssemblyQualifiedName; } StringBuilder lStringBuilder = new StringBuilder(); lStringBuilder.Append("{"); // These four properties are important from the base MotionControllerMotion lStringBuilder.Append(", \"Type\" : \"" + _Type + "\""); lStringBuilder.Append(", \"Name\" : \"" + _Name + "\""); lStringBuilder.Append(", \"IsEnabled\" : \"" + _IsEnabled.ToString() + "\""); lStringBuilder.Append(", \"ActionAlias\" : \"" + _ActionAlias.ToString() + "\""); lStringBuilder.Append(", \"UseRigAnchor\" : \"" + _UseRigAnchor.ToString() + "\""); lStringBuilder.Append(", \"AnchorIndex\" : \"" + _AnchorIndex.ToString() + "\""); lStringBuilder.Append(", \"AnchorOffset\" : \"" + _AnchorOffset.Serialize() + "\""); lStringBuilder.Append(", \"Offset\" : \"" + _Offset.Serialize() + "\""); lStringBuilder.Append(", \"Distance\" : \"" + Distance.ToString("f5", CultureInfo.InvariantCulture) + "\""); lStringBuilder.Append(", \"MaxDistance\" : \"" + MaxDistance.ToString("f5", CultureInfo.InvariantCulture) + "\""); lStringBuilder.Append(", \"IsCollisionEnabled\" : \"" + _IsCollisionEnabled.ToString() + "\""); lStringBuilder.Append(", \"IsFadingEnabled\" : \"" + _IsFadingEnabled.ToString() + "\""); lStringBuilder.Append(", \"SpecifyFadeRenderers\" : \"" + _SpecifyFadeRenderers.ToString() + "\""); lStringBuilder.Append(", \"FadeTransformIndexes\" : \"" + string.Join(",", _FadeTransformIndexes.Select(n => n.ToString()).ToArray()) + "\""); // Cycle through all the properties. // Unfortunately Binding flags don't seem to be working. So, // we need to ensure we don't include base properties PropertyInfo[] lBaseProperties = typeof(CameraMotor).GetProperties(); PropertyInfo[] lProperties = this.GetType().GetProperties(); foreach (PropertyInfo lProperty in lProperties) { if (!lProperty.CanWrite) { continue; } bool lAdd = true; for (int i = 0; i < lBaseProperties.Length; i++) { if (lProperty.Name == lBaseProperties[i].Name) { lAdd = false; break; } } if (!lAdd || lProperty.GetValue(this, null) == null) { continue; } object lValue = lProperty.GetValue(this, null); if (lProperty.PropertyType == typeof(Vector2)) { lStringBuilder.Append(", \"" + lProperty.Name + "\" : \"" + ((Vector2)lValue).Serialize() + "\""); } else if (lProperty.PropertyType == typeof(Vector3)) { lStringBuilder.Append(", \"" + lProperty.Name + "\" : \"" + ((Vector3)lValue).Serialize() + "\""); } else if (lProperty.PropertyType == typeof(Vector4)) { lStringBuilder.Append(", \"" + lProperty.Name + "\" : \"" + ((Vector4)lValue).Serialize() + "\""); } else if (lProperty.PropertyType == typeof(Quaternion)) { lStringBuilder.Append(", \"" + lProperty.Name + "\" : \"" + ((Quaternion)lValue).Serialize() + "\""); } else if (lProperty.PropertyType == typeof(Transform)) { // We use the _StoredTransformIndex for serialization } else if (lProperty.PropertyType == typeof(List <int>)) { List <int> lList = lValue as List <int>; lStringBuilder.Append(", \"" + lProperty.Name + "\" : \"" + string.Join(",", lList.Select(n => n.ToString(CultureInfo.InvariantCulture)).ToArray()) + "\""); } else if (lProperty.PropertyType == typeof(AnimationCurve)) { lStringBuilder.Append(", \"" + lProperty.Name + "\" : \""); AnimationCurve lCurve = lValue as AnimationCurve; lStringBuilder.Append(lCurve.Serialize()); lStringBuilder.Append("\""); } else { lStringBuilder.Append(", \"" + lProperty.Name + "\" : \"" + lValue.ToString() + "\""); } } lStringBuilder.Append("}"); return(lStringBuilder.ToString()); }