public void Display(string divider) { Console.WriteLine(MaxSpeed.ToString() + divider + Measurement["speed"]); Console.WriteLine(Power.ToString() + divider + Measurement["power"]); Console.WriteLine(Weight.ToString() + divider + Measurement["weight"]); Console.WriteLine(TimeTo100.ToString() + divider + Measurement["time"]); }
private static void AdjustStats(Engine e, Acceleration acceleration, MaxSpeed max, TurnSpeed turn, Engine.FuelRegenerationStyle fuelRegenerationStyle) { e.acceleration = GetAccelerationValue(acceleration); e.maxSpeed = GetMaxSpeedValue(max); e.turnSpeed = GetTurnSpeedValue(turn); e.fuelRegenStyle = fuelRegenerationStyle; }
public override int GetHashCode() { int hash = 1; if (VehicleId.Length != 0) { hash ^= VehicleId.GetHashCode(); } if (CustomerId.Length != 0) { hash ^= CustomerId.GetHashCode(); } if (Registration.Length != 0) { hash ^= Registration.GetHashCode(); } if (MakeModel.Length != 0) { hash ^= MakeModel.GetHashCode(); } if (MaxSpeed != 0) { hash ^= MaxSpeed.GetHashCode(); } if (MaxTemperature != 0) { hash ^= MaxTemperature.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public virtual void AdditionalInfo() { Console.WriteLine("\tCost: {0} $", Cost.ToString("#.##")); Console.WriteLine("\tMileage: {0} km", Mileage.ToString("#.##")); Console.WriteLine("\tWeight: {0} kg", Weight.ToString("#.###")); Console.WriteLine("\tMax speed: {0} km/h", MaxSpeed.ToString("#.##")); }
public override string ToString() { return(string.Format( "{0} car with {1} max speed and {2} seats}", FuelType.ToString(), MaxSpeed.ToString(), SeatCount.ToString())); }
public int CompareTo(Car o) { if (o != null) { return(MaxSpeed.CompareTo(o.MaxSpeed)); } throw new Exception("Cannot compare two cars"); }
private void OnGUI() { Rect maxSpeedRect = new Rect(Screen.width / 2, 0, (Screen.width / 2) - 10, 40); Rect forwardSpeedRect = new Rect(Screen.width / 2, 40, (Screen.width / 2) - 10, 40); Rect speedRect = new Rect(Screen.width / 2, 80, (Screen.width / 2) - 10, 40); GUI.color = Color.black; Rect bgBounds = new Rect((Screen.width / 5) * 4, 0, Screen.width / 5, 120); GUI.Box(bgBounds, ""); bgBounds = new Rect(0, 0, Screen.width / 6, 60); GUI.Box(bgBounds, ""); GUI.color = Color.white; GUIStyle speedStyle = GUI.skin.label; speedStyle.alignment = TextAnchor.MiddleRight; speedStyle.fontSize = 20; GUI.Label(maxSpeedRect, "Max-Speed: " + MaxSpeed.ToString("F1"), speedStyle); GUI.Label(forwardSpeedRect, "F-Speed: " + (m_PlayerInfo.currentSpeed * transform.up.y).ToString("F1"), speedStyle); GUI.Label(speedRect, "C-Speed: " + m_PlayerInfo.currentSpeed.ToString("F1"), speedStyle); GUIStyle scoreStyle = GUI.skin.label; scoreStyle.fontSize = 22; scoreStyle.alignment = TextAnchor.MiddleLeft; Rect scoreRect = new Rect(10, 0, (Screen.width / 5), 60); GUI.Label(scoreRect, "Score: " + m_PlayerInfo.currentScore.ToString(), scoreStyle); //Start of stam bar code Vector2 dodgeBarSize = new Vector2(Screen.width * 0.3f, 20); Texture2D emptyTex = Texture2D.blackTexture;//Resources.Load<Texture2D>("Sprites/yellow"); Texture2D fullTex = Resources.Load <Texture2D>("Sprites/blue"); Rect boxSegment = new Rect(Screen.width * 0.2f, Screen.height * 0.9f, dodgeBarSize.x / 5, dodgeBarSize.y); Rect dodgeBarRect = new Rect(Screen.width * 0.35f, Screen.height * 0.9f, dodgeBarSize.x, dodgeBarSize.y); GUI.BeginGroup(dodgeBarRect); GUI.Box(new Rect(0, 0, dodgeBarRect.width, dodgeBarRect.height), emptyTex); GUIStyle stamStyle = GUI.skin.label; stamStyle.fontSize = 14; stamStyle.alignment = TextAnchor.MiddleCenter; GUI.DrawTexture(new Rect(0, 0, dodgeBarSize.x * (Mathf.Clamp(m_PlayerInfo.stamina, 0, m_MaxStamina) / m_MaxStamina), dodgeBarSize.y), fullTex); GUI.color = Color.black; GUI.Box(new Rect(boxSegment.width, boxSegment.height * 0.25f, boxSegment.width / 20, boxSegment.height * 0.5f), emptyTex); GUI.Box(new Rect(boxSegment.width * 2, boxSegment.height * 0.25f, boxSegment.width / 20, boxSegment.height * 0.5f), emptyTex); GUI.Box(new Rect(boxSegment.width * 3, boxSegment.height * 0.25f, boxSegment.width / 20, boxSegment.height * 0.5f), emptyTex); GUI.Box(new Rect(boxSegment.width * 4, boxSegment.height * 0.25f, boxSegment.width / 20, boxSegment.height * 0.5f), emptyTex); GUI.color = Color.white; GUI.Label(new Rect(0, 0, dodgeBarRect.width, dodgeBarRect.height), "Stamina ", stamStyle); GUI.EndGroup(); //end of dodge bar }
public int CompareTo(object o) { Car car = (Car)o; if (car != null) { return(MaxSpeed.CompareTo(car.MaxSpeed)); } throw new Exception("Cannot compare two cars"); }
public virtual string Print() { // do nothing return("Brand: " + Brand + "; Model: " + Model + "; MaxSpeed: " + MaxSpeed.ToString() + "; Cost: " + Cost.ToString() + "; Year: " + Year.ToString() + "; Location: " + Location); }
public int CompareTo(Car other) { if (ReferenceEquals(this, other)) { return(0); } return(other is null ? 1 : MaxSpeed.CompareTo(other.MaxSpeed)); }
public override int GetHashCode() { var hashCode = -592927958; hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Brand); hashCode = hashCode * -1521134295 + Price.GetHashCode(); hashCode = hashCode * -1521134295 + MaxSpeed.GetHashCode(); hashCode = hashCode * -1521134295 + YearOfRelease.GetHashCode(); return(hashCode); }
private void Update(EvaluationContext context) { _boids.TypedElements[0].CohesionRadius = CohesionRadius.GetValue(context); _boids.TypedElements[0].CohesionDrive = CohesionDrive.GetValue(context); _boids.TypedElements[0].AlignmentRadius = AlignmentRadius.GetValue(context); _boids.TypedElements[0].AlignmentDrive = AlignmentDrive.GetValue(context); _boids.TypedElements[0].SeparationRadius = SeparationRadius.GetValue(context); _boids.TypedElements[0].SeparationDrive = SeparationDrive.GetValue(context); _boids.TypedElements[0].MaxSpeed = MaxSpeed.GetValue(context); OutBuffer.Value = _boids; }
public override int GetHashCode() { var hashCode = -1043886837; hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Model); hashCode = hashCode * -1521134295 + MaxSpeed.GetHashCode(); hashCode = hashCode * -1521134295 + MaxFlightDistance.GetHashCode(); hashCode = hashCode * -1521134295 + MaxLoadCapacity.GetHashCode(); return(hashCode); }
override public string ToString() { StringBuilder text = new StringBuilder("Track statistics:\n"); text.AppendLine("Total distance: " + Distance.ToString("N1")); text.AppendLine("Total time: " + Time.ToString("N2")); text.AppendLine("Average velocity (by time): " + (Distance / Time).ToString("N1")); text.AppendLine("Average velocity (by distance): " + (AvdSpeed / Distance).ToString("N1")); text.AppendLine("Minimum velocity: " + MinSpeed.ToString("N2")); text.AppendLine("Maximum velocity: " + MaxSpeed.ToString("N1")); return(text.ToString()); }
public (int, int, int, int, int) CompareCarProperties(Car other) { var comparisonTuple = ( maxSpeedComparison : MaxSpeed.CompareTo(other.MaxSpeed), accelerationComparison : Acceleration.CompareTo(other.Acceleration), cylinderComparison : Cylinders.CompareTo(other.Cylinders), engineSizeComparison : EngineSize.CompareTo(other.EngineSize), horsePowerComparison : HorsePower.CompareTo(other.HorsePower) ); return(comparisonTuple); }
public override int GetHashCode() { int hash = 1; if (MaxSpeed != 0D) { hash ^= MaxSpeed.GetHashCode(); } if (MaxMoveDestLaneShiftY != 0D) { hash ^= MaxMoveDestLaneShiftY.GetHashCode(); } return(hash); }
public override XElement CreateXmlElement() { var element = new XElement("door"); element.SetAttributeValue("uid", Uid); element.SetAttributeValue("x", X.ToString()); element.SetAttributeValue("y", Y.ToString()); element.SetAttributeValue("w", Width.ToString()); element.SetAttributeValue("h", Height.ToString()); element.SetAttributeValue("tarx", TarX.ToString()); element.SetAttributeValue("tary", TarY.ToString()); element.SetAttributeValue("maxspeed", MaxSpeed.ToString()); element.SetAttributeValue("vis", Visible.ToString().ToLower()); element.SetAttributeValue("moving", Moving.ToString().ToLower()); return(element); }
public override int GetHashCode() { var hashCode = 793576678; hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Brand); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Model); hashCode = hashCode * -1521134295 + Color.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <Guid> .Default.GetHashCode(Vin); hashCode = hashCode * -1521134295 + Fuel.GetHashCode(); hashCode = hashCode * -1521134295 + MaxSpeed.GetHashCode(); hashCode = hashCode * -1521134295 + Horsepowers.GetHashCode(); hashCode = hashCode * -1521134295 + EngineCapacity.GetHashCode(); return(hashCode); }
public override bool IsSearchContains(string text) { text = text.ToUpper(); if (type.ToUpper().Contains(text) || Name.ToUpper().Contains(text) || Weight.ToString().Contains(text) || MaxSpeed.ToString().Contains(text) || MassOfCoal.ToString().Contains(text) || RangeOfTravel.ToString().Contains(text)) { return(true); } else { return(false); } }
public override bool IsSearchContains(string text) { text = text.ToUpper(); if (type.ToUpper().Contains(text) || Name.ToUpper().Contains(text) || Weight.ToString().Contains(text) || MaxSpeed.ToString().Contains(text) || SailMaterial.ToUpper().Contains(text) || SailArea.ToString().Contains(text)) { return(true); } else { return(false); } }
public override bool IsSearchContains(string text) { text = text.ToUpper(); if (type.ToUpper().Contains(text) || Name.ToUpper().Contains(text) || Weight.ToString().Contains(text) || MaxSpeed.ToString().Contains(text) || Armament.ToUpper().Contains(text) || Equipment.ToUpper().Contains(text)) { return(true); } else { return(false); } }
private static float GetMaxSpeedValue(MaxSpeed max) { switch (max) { case MaxSpeed.Slow: return(0); case MaxSpeed.Average: return(0); case MaxSpeed.Fast: return(0); case MaxSpeed.VeryFast: return(0); default: return(0); } }
public override void AdditionalInfo() { Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine("\t----- Additional information -----"); Console.ResetColor(); Console.WriteLine($"\tSeats: {Seats}"); Console.WriteLine($"\tDoors: {Doors}"); Console.WriteLine("\tWeight: {0} kg", Weight.ToString("#.###")); Console.WriteLine("\tMax speed: {0} km/h", MaxSpeed.ToString("#.##")); Console.WriteLine($"\tType of transmission: {Transmission}"); Console.WriteLine($"\tType of drivetrain: {DriveTrain}"); Console.WriteLine("\tTank: {0} L", Tank.ToString("#.##")); Console.WriteLine("\tFuel consumption: {0} L/100km", FuelConsumption.ToString("#.##")); Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine("\t----- Engine specifications -----"); Console.ResetColor(); ((IEngine)this).EngineInfo(); }
public void InitIfNeeded() { _HasContentVisual = ContentVisual != null; float maxAllowed; string asString; if (LoopItems) { maxAllowed = MAX_SPEED_IF_LOOPING; asString = "MAX_SPEED_IF_LOOPING"; } else { maxAllowed = MAX_SPEED; asString = "MAX_SPEED"; } float maxSpeedClamped = Mathf.Clamp(MaxSpeed, 0f, maxAllowed); if (Math.Abs(maxSpeedClamped - MaxSpeed) > 1f) { Debug.Log("OSA: maxSpeed(" + MaxSpeed.ToString("#########.00") + ") value is negative or exceeded " + asString + "(" + maxAllowed.ToString("#########.00") + "). Clamped it to " + maxSpeedClamped.ToString("#########.00") ); MaxSpeed = maxSpeedClamped; } if (ElasticMovement && LoopItems) { ElasticMovement = false; Debug.Log("OSA: 'elasticMovement' was set to false, because 'loopItems' is true. Elasticity only makes sense when there is an end"); } if (HasContentVisual) { ContentVisual.rectTransform.MatchParentSize(true); } InitGalleryEffectMigrations(); }
public MaxSpeed Obu1_GetMaxSpeed(string vehID) { MySqlConnection conn = new MySqlConnection(connStr); try { conn.Open(); string address = "http://127.0.0.1:8080/TRAAS_WS"; string sql = string.Format("SELECT veh_id, max_speed, address FROM maxspeed WHERE veh_id='{0}' AND address='{1}'", vehID, address); MySqlCommand command = new MySqlCommand(sql, conn); MySqlDataReader reader = command.ExecuteReader(); reader.Read(); MaxSpeed hitrost = new MaxSpeed(); hitrost.VehId = Convert.ToString(reader[0]); hitrost.MaximumSpeed = Convert.ToDouble(reader[1]); hitrost.Address = Convert.ToString(reader[2]); if (hitrost.VehId == null) { throw new Exception("No vehicle with such ID"); } return(hitrost); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } finally { conn.Close(); } return(new MaxSpeed()); //throw new Exception("No vehicle with such ID"); }
private void OpenStatistic_Click(object sender, RoutedEventArgs e) { if (Height < Settings.fieldHeight + 200) { Height = Settings.fieldHeight + 200; } Binding binding = new Binding(); binding.StringFormat = Languages.Statistic.PeacStatistic + "{0}"; binding.Path = new PropertyPath("allTimePeacCounter"); Peac.SetBinding(TextBlock.TextProperty, binding); binding = new Binding(); binding.StringFormat = Languages.Statistic.EvilStatistic + "{0}"; binding.Path = new PropertyPath("allTimeEvilCounter"); Evil.SetBinding(TextBlock.TextProperty, binding); binding = new Binding(); binding.StringFormat = Languages.Statistic.MaxSpeedStatistic + "{0}"; binding.Path = new PropertyPath("maxSpeed"); MaxSpeed.SetBinding(TextBlock.TextProperty, binding); binding = new Binding(); binding.StringFormat = Languages.Statistic.MaxRotationSpeedStatistic + "{0}"; binding.Path = new PropertyPath("maxRotationSpeed"); MaxRotationSpeed.SetBinding(TextBlock.TextProperty, binding); binding = new Binding(); binding.StringFormat = Languages.Statistic.MaxMaxHealSpeedStatistic + "{0}"; binding.Path = new PropertyPath("maxMaxHeal"); MaxMaxHealSpeed.SetBinding(TextBlock.TextProperty, binding); binding = new Binding(); binding.StringFormat = Languages.Statistic.MaxMaxAgeSpeedStatistic + "{0}"; binding.Path = new PropertyPath("maxMaxAge"); MaxMaxAgeSpeed.SetBinding(TextBlock.TextProperty, binding); }
public void Obu1_PutMaxSpeed([FromBody] MaxSpeed obj) { MySqlConnection conn = new MySqlConnection(connStr); try { conn.Open(); MySqlCommand command = new MySqlCommand("UPDATE maxspeed SET max_speed=@Parname1 WHERE veh_id=@Parname2 AND address=@Parname3", conn); command.Parameters.Add("@Parname1", MySqlDbType.Double).Value = obj.MaximumSpeed; command.Parameters.Add("@Parname2", MySqlDbType.String).Value = obj.VehId; command.Parameters.Add("@Parname3", MySqlDbType.String).Value = obj.Address; command.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } finally { conn.Close(); } }
public int CompareTo(Car other) { if ((other == null) || !this.GetType().Equals(other.GetType())) { return(1); } Car car = other as Car; if (car == null) { throw new ArgumentException("Object is not a Temperature"); } else { switch (car.Compare) { case CompareBy.CCM: return(CCM.CompareTo(car.CCM)); case CompareBy.Cylinder: return(Cylinder.CompareTo(car.Cylinder)); case CompareBy.Power: return(Power.CompareTo(car.Power)); case CompareBy.RPM: return(RPM.CompareTo(car.RPM)); case CompareBy.UpToHundred: return(UpToHundred.CompareTo(car.UpToHundred)); default: return(MaxSpeed.CompareTo(car.MaxSpeed)); // Max Speed is default } } }
public int CompareTo(Plane other) { if (other == null) { return(1); } if (MaxSpeed != other.MaxSpeed) { return(MaxSpeed.CompareTo(other.MaxSpeed)); } if (MaxCountBomb != other.MaxCountBomb) { return(MaxCountBomb.CompareTo(other.MaxCountBomb)); } if (Weight != other.Weight) { return(Weight.CompareTo(other.Weight)); } if (ColorBody != other.ColorBody) { ColorBody.Name.CompareTo(other.ColorBody.Name); } return(0); }
public int CompareTo(MotorShip other) { if (other == null) { return(1); } if (MaxSpeed != other.MaxSpeed) { return(MaxSpeed.CompareTo(other.MaxSpeed)); } if (MaxCountPassengers != other.MaxCountPassengers) { return(MaxCountPassengers.CompareTo(other.MaxCountPassengers)); } if (Weight != other.Weight) { return(Weight.CompareTo(other.Weight)); } if (ColorBody != other.ColorBody) { ColorBody.Name.CompareTo(other.ColorBody.Name); } return(0); }