Exemplo n.º 1
0
 public virtual void Draw(Graphics g, int sectorId)
 {
     if (sectorId == Sector1.Id)
     {
         End1.Draw(g, sectorId);
     }
     if (sectorId == Sector2.Id)
     {
         End2.Draw(g, sectorId);
     }
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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();
            }
        }
Exemplo n.º 5
0
 public override String ToString()
 {
     return(HttpUtility.UrlDecode(End1.ToString() + " - " + End2.ToString() + (TaggedValues.Count > 0 ? " <Tags:" + TaggedValues.Count + ">" : "")));
 }