Example #1
0
File: Rope.cs Project: theKyuu/GLhf
 public override void loadContent()
 {
     base.loadContent();
     m_startPosition = m_position;
     m_endPosition = new CartesianCoordinate(m_position.getGlobalCartesian() + new Vector2(0, (float)Math.Max(m_lenght, 72)));
     m_endPosition.setParentPositionWithoutMoving(m_startPosition);
     m_line = new Line(m_startPosition, m_endPosition, new Vector2(36, 0), new Vector2(36, 0), Color.Beige, 5, true);
     m_line.setLayer(m_layer);
     m_collisionShape = new CollisionLine(m_startPosition.getGlobalCartesian(), m_endPosition.getGlobalCartesian());
     m_rotationPoint.Y = 0;
     m_rotate = (float)Math.PI / 2;
 }
Example #2
0
 public override void setParentPositionWithoutMoving(Position a_parentPosition)
 {
     Position t_parent = a_parentPosition;
     while (t_parent != null)
     {
         if (t_parent == this)
         {
             throw new ArgumentException("This parenting will cause an inheirt paradox");
         }
         else
         {
             t_parent = t_parent.getParentPosition();
         }
     }
     if (a_parentPosition == null)
     {
         m_coordinates = getGlobalPolar();
     }
     else{
         m_coordinates = convertCartesianToPolar(getGlobalCartesian() - a_parentPosition.getGlobalCartesian());
     }
     m_parentPosition = a_parentPosition;
 }
Example #3
0
 public float getDistanceTo(Position a_point)
 {
     return (a_point.getGlobalCartesian()-getGlobalCartesian()).Length();
 }
Example #4
0
File: Rope.cs Project: theKyuu/GLhf
 public void setStartPoint(Vector2 a_startPoint)
 {
     m_startPosition = new CartesianCoordinate(a_startPoint);
     m_endPosition.setParentPositionWithoutMoving(m_startPosition);
     m_line.setStartPoint(m_startPosition.getGlobalCartesian());
     m_lenght = m_line.getStartPoint().getDistanceTo(m_line.getEndPoint());
     m_position = m_startPosition;
 }
Example #5
0
 public override void setPosition(Position a_position)
 {
     setStartPosition(a_position.getGlobalCartesian());
 }