public virtual void Draw(Graphics g, int sectorId) { if (sectorId == Sector1.Id) { End1.Draw(g, sectorId); } if (sectorId == Sector2.Id) { End2.Draw(g, sectorId); } }
public void SetVisibleToTeam(int team, bool visible) { var t = team - 1; if (t < 0 || t >= _game.NumTeams) { return; } Sector1.SetVisibleToTeam(t, visible); Sector2.SetVisibleToTeam(t, visible); End1.SetVisibleToTeam(t, visible); End2.SetVisibleToTeam(t, visible); }
public override void Update(GameTime gameTime) { var x = End1.Position - End2.Position; float length = x.Length(); if (length <= TargetLength) { return; } x = (x / length) * (length - TargetLength); var dv = End2.Velocity - End1.Velocity; var force = Stiffness * x - dv * Damping; End1.ApplyForce(-force); End2.ApplyForce(force); }
public override void Write(Utf8JsonWriter writer) { base.Write(writer); if (End1 != null) { writer.WritePropertyName(End1PropertyName); writer.WriteStartObject(); End1.Write(writer); writer.WriteEndObject(); } if (End2 != null) { writer.WritePropertyName(End2PropertyName); writer.WriteStartObject(); End2.Write(writer); writer.WriteEndObject(); } }
public override String ToString() { return(HttpUtility.UrlDecode(End1.ToString() + " - " + End2.ToString() + (TaggedValues.Count > 0 ? " <Tags:" + TaggedValues.Count + ">" : ""))); }