Beispiel #1
0
 public BodyAttractionArgs(BodyAttractionType attractionType, bool isToward, double strength, double distance)
 {
     this.AttractionType = attractionType;
     this.IsToward       = isToward;
     this.Strength       = strength;
     this.Distance       = distance;
 }
Beispiel #2
0
        private void SetDistanceTrackbarVisibility()
        {
            BodyAttractionType attractionType = GetAttractionType();

            switch (attractionType)
            {
            case BodyAttractionType.None:
            case BodyAttractionType.Gravity:
            case BodyAttractionType.Spring:
            case BodyAttractionType.Constant:
                lblDistance.Visibility = Visibility.Collapsed;
                trkDistance.Visibility = Visibility.Collapsed;
                break;

            case BodyAttractionType.SpringInverseDist:
            case BodyAttractionType.SpringDesiredDistance:
            case BodyAttractionType.Tangent:
                lblDistance.Visibility = Visibility.Visible;
                trkDistance.Visibility = Visibility.Visible;
                break;

            default:
                throw new ApplicationException("Unknown BodyAttractionType: " + attractionType.ToString());
            }
        }
Beispiel #3
0
        private void FireAttractEvent()
        {
            if (this.AttractionChanged == null)
            {
                return;
            }

            BodyAttractionType attractionType = GetAttractionType();

            double distance = trkDistance.Value;
            double strength;

            switch (attractionType)
            {
            case BodyAttractionType.Gravity:
                strength = UtilityCore.GetScaledValue_Capped(0, 125, trkStrength.Minimum, trkStrength.Maximum, trkStrength.Value);
                break;

            case BodyAttractionType.Spring:
                strength = UtilityCore.GetScaledValue_Capped(0, 10, trkStrength.Minimum, trkStrength.Maximum, trkStrength.Value);
                break;

            case BodyAttractionType.SpringDesiredDistance:
                strength = UtilityCore.GetScaledValue_Capped(0, 50, trkStrength.Minimum, trkStrength.Maximum, trkStrength.Value);
                distance = UtilityCore.GetScaledValue_Capped(0, 100, trkDistance.Minimum, trkDistance.Maximum, trkDistance.Value);
                break;

            case BodyAttractionType.SpringInverseDist:
                strength = UtilityCore.GetScaledValue_Capped(0, 10, trkStrength.Minimum, trkStrength.Maximum, trkStrength.Value);
                break;

            case BodyAttractionType.Tangent:
                strength = UtilityCore.GetScaledValue_Capped(0, 200, trkStrength.Minimum, trkStrength.Maximum, trkStrength.Value);
                distance = UtilityCore.GetScaledValue_Capped(0, 50, trkDistance.Minimum, trkDistance.Maximum, trkDistance.Value);
                break;

            case BodyAttractionType.Constant:
                strength = UtilityCore.GetScaledValue_Capped(0, 20, trkStrength.Minimum, trkStrength.Maximum, trkStrength.Value);
                break;

            default:
                strength = UtilityCore.GetScaledValue_Capped(0, 100, trkStrength.Minimum, trkStrength.Maximum, trkStrength.Value);
                break;
            }

            BodyAttractionArgs args = new BodyAttractionArgs(GetAttractionType(), GetIsToward(), strength, distance);

            this.AttractionChanged(this, args);
        }
		public BodyAttractionArgs(BodyAttractionType attractionType, bool isToward, double strength, double distance)
		{
			this.AttractionType = attractionType;
			this.IsToward = isToward;
			this.Strength = strength;
			this.Distance = distance;
		}