示例#1
0
文件: Rope.cs 项目: 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;
 }
示例#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;
 }
示例#3
0
文件: Position.cs 项目: theKyuu/GLhf
 public float getDistanceTo(Position a_point)
 {
     return (a_point.getGlobalCartesian()-getGlobalCartesian()).Length();
 }
示例#4
0
文件: Rope.cs 项目: 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;
 }
示例#5
0
 public override void setPosition(Position a_position)
 {
     setStartPosition(a_position.getGlobalCartesian());
 }