示例#1
0
 public virtual void changePositionType()
 {
     if (m_position is CartesianCoordinate)
         m_position = new PolarCoordinate(m_position.getLocalPolarCoordinates(), m_position.getParentPosition());
     else
         m_position = new CartesianCoordinate(m_position.getLocalCartesianCoordinates(), m_position.getParentPosition());
 }
示例#2
0
        public CollisionTriangle(Vector2[] a_points, Position a_position)
        {
            if (a_points == null)
            {
                throw new ArgumentNullException("points in triangle cannot be null");
            }
            if (a_position == null)
            {
                throw new ArgumentNullException("position for triangle cannot be null");
            }
            if (a_points.Length != 3)
            {
                throw new ArgumentException("triangle needs exactly 3 points, got " + a_points.Length);
            }
            m_AOffset = a_points[0];
            m_BOffset = a_points[1];
            m_COffset = a_points[2];
            m_position = a_position;

            int t_lowestX = (int)Math.Floor(Math.Min(Math.Min(m_AOffset.X,m_BOffset.X),m_COffset.X) + m_position.getGlobalX());
            int t_lowestY = (int)Math.Floor(Math.Min(Math.Min(m_AOffset.Y, m_BOffset.Y), m_COffset.Y) + m_position.getGlobalY());
            int t_width = (int)Math.Ceiling(Math.Max(Math.Max(m_AOffset.X, m_BOffset.X), m_COffset.X) - Math.Min(Math.Min(m_AOffset.X, m_BOffset.X), m_COffset.X));
            int t_height = (int)Math.Ceiling(Math.Max(Math.Max(m_AOffset.Y, m_BOffset.Y), m_COffset.Y) - Math.Min(Math.Min(m_AOffset.Y, m_BOffset.Y), m_COffset.Y));
            m_OutBox = new Rectangle(t_lowestX, t_lowestY, t_width, t_height);
        }
示例#3
0
文件: Camera.cs 项目: theKyuu/GLhf
 public Camera()
 {
     m_zoom = 1.0f;
     m_rotation = 0.0f;
     m_position = new CartesianCoordinate(Vector2.Zero);
     load();
 }
示例#4
0
文件: Rope.cs 项目: theKyuu/GLhf
 public void setEndPoint(Vector2 a_endPoint)
 {
     m_endPosition = new CartesianCoordinate(a_endPoint);
     m_endPosition.setParentPositionWithoutMoving(m_startPosition);
     m_endPosition.plusXWith(36);
     m_line.setEndPoint(m_endPosition);
     m_lenght = m_line.getStartPoint().getDistanceTo(m_line.getEndPoint());
 }
示例#5
0
 public GameObject(Vector2 a_posV2, string a_sprite, float a_layer)
 {
     m_objectId = ++s_lastId;
     m_position = new CartesianCoordinate(a_posV2);
     m_rotate = 0.0f;
     m_layer = a_layer;
     m_spritePath = a_sprite;
     loadContent();
 }
示例#6
0
 public CollisionRectangle(float a_xOffset, float a_yOffset, float a_width, float a_height, Position a_position)
 {
     m_xOffset = a_xOffset;
     m_yOffset = a_yOffset;
     m_width = a_width;
     m_height = a_height;
     m_position = a_position;
     m_OutBox = new Rectangle((int)(m_xOffset + m_position.getGlobalX()), (int)(m_yOffset + m_position.getGlobalY()), (int)m_width, (int)m_height);
 }
示例#7
0
 public GameObject(Position a_position, string a_sprite, float a_layer, float a_rotation = 0)
 {
     m_objectId = ++s_lastId;
     m_rotate = a_rotation;
     m_position = a_position;
     m_layer = a_layer;
     m_spritePath = a_sprite;
     loadContent();
 }
示例#8
0
 public CollisionLine(Vector2 a_start, Vector2 a_end)
 {
     m_position = new CartesianCoordinate(a_start);
     m_endPosition = new CartesianCoordinate(a_end);
     m_OutBox.X = (int)Math.Floor(Math.Min(m_position.getGlobalX(), m_endPosition.getGlobalX()));
     m_OutBox.Y = (int)Math.Floor(Math.Min(m_position.getGlobalY(), m_endPosition.getGlobalY()));
     m_OutBox.Width = (int)Math.Floor(Math.Abs(Math.Max(m_position.getGlobalX(), m_endPosition.getGlobalX()) - Math.Min(m_position.getGlobalX(), m_endPosition.getGlobalX())));
     m_OutBox.Height = (int)Math.Floor(Math.Abs(Math.Max(m_position.getGlobalY(), m_endPosition.getGlobalY()) - Math.Min(m_position.getGlobalY(), m_endPosition.getGlobalY())));
 }
示例#9
0
文件: Cutscene.cs 项目: theKyuu/GLhf
 public override void load()
 {
     if (m_filePath != null)
     {
         m_commands = Loader.getInstance().readFromFile(m_filePath);
     }
     m_oldCamPar = Game.getInstance().m_camera.getPosition().getParentPosition();
     Game.getInstance().m_camera.getPosition().setParentPositionWithoutMoving(null);
     base.load();
 }
示例#10
0
文件: Rope.cs 项目: Yuma-Shi/GLhf
 public override void loadContent()
 {
     base.loadContent();
     m_startPosition = m_position;
     m_endPosition = new CartesianCoordinate(m_position.getGlobalCartesianCoordinates() + 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.Black, 5, true);
     m_collisionShape = new CollisionRectangle(33, 0, 6, m_lenght, m_startPosition);
     m_rotationPoint.Y = 0;
     m_rotate = (float)Math.PI / 2;
 }
示例#11
0
文件: Button.cs 项目: Yuma-Shi/GLhf
 public Button(string a_buttonTexture, Vector2 a_position)
 {
     m_position = new CartesianCoordinate(a_position, Game.getInstance().m_camera.getPosition());
     setPosition(a_position);
     m_bounds = new Rectangle((int)a_position.X, (int)a_position.Y, 0, 0);
     m_layer = 0.002f;
     m_upSound = null;
     m_downSound = null;
     m_buttonTexture = a_buttonTexture;
     loadContent();
 }
示例#12
0
文件: Rope.cs 项目: melburn/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.setTexture("Images/Automagi/wtfrope");
     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;
 }
示例#13
0
文件: Button.cs 项目: Yuma-Shi/GLhf
 public Button(string a_buttonTexture, Vector2 a_position, string a_buttonText, string a_font, Color a_color, Vector2 a_offset)
 {
     if (a_font == null)
     {
         a_font = "Courier New";
     }
     m_text = new Text(a_position, a_offset, a_buttonText, a_font, a_color, false);
     m_position = new CartesianCoordinate(a_position, Game.getInstance().m_camera.getPosition());
     setPosition(a_position);
     m_bounds = new Rectangle((int)a_position.X, (int)a_position.Y, 0, 0);
     m_layer = 0.002f;
     m_upSound = null;
     m_downSound = null;
     m_buttonTexture = a_buttonTexture;
     loadContent();
 }
示例#14
0
文件: Button.cs 项目: Yuma-Shi/GLhf
 public Button(string a_normal, string a_hover, string a_pressed, string a_toggle, Vector2 a_position, string a_buttonText, string a_font, Color a_color, Vector2 a_offset)
 {
     setNormalTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_normal));
     setHoverTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_hover));
     setPressedTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_pressed));
     setToggleTexture(Game.getInstance().Content.Load<Texture2D>("Images//GUI//" + a_toggle));
     if (a_font == null)
     {
         a_font = "Courier New";
     }
     m_text = new Text(a_position, a_offset, a_buttonText, a_font, a_color, false);
     m_position = new CartesianCoordinate(a_position);
     m_position.setParentPosition(Game.getInstance().m_camera.getPosition());
     setPosition(a_position);
     m_bounds = new Rectangle((int)a_position.X, (int)a_position.Y, (int)m_size.X, (int)m_size.Y);
     m_layer = 0.002f;
     m_upSound = null;
     m_downSound = null;
 }
示例#15
0
文件: Line.cs 项目: Yuma-Shi/GLhf
 public Line(Position a_startPosition, Position a_endPosition, Vector2 a_startOffset, Vector2 a_endOffset, Color a_color, int a_width, bool a_worldLine)
 {
     m_startOffset = a_startOffset;
     m_endOffset = a_endOffset;
     m_lineTexture = new Texture2D(Game.getInstance().GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
     if (a_worldLine)
     {
         m_startPosition = new CartesianCoordinate(a_startOffset, a_startPosition);
         m_endPosition = new CartesianCoordinate(a_endOffset, a_endPosition);
     }
     else
     {
         m_startPosition = new CartesianCoordinate(a_startOffset, Game.getInstance().m_camera.getPosition());
         m_endPosition = new CartesianCoordinate(a_endOffset, Game.getInstance().m_camera.getPosition());
     }
     m_lineColor = a_color;
     m_lineTexture.SetData(new[] { a_color });
     m_width = a_width;
     m_worldLine = a_worldLine;
 }
示例#16
0
 public CartesianCoordinate(Vector2 a_offset, Position a_parentPosition)
 {
     m_coordinates = a_offset;
     m_parentPosition = a_parentPosition;
 }
示例#17
0
文件: Entity.cs 项目: Yuma-Shi/GLhf
 public Entity(Position a_position, String a_sprite, float a_layer, float a_rotation = 0)
     : base(a_position, a_sprite, a_layer, a_rotation)
 {
 }
示例#18
0
文件: Line.cs 项目: melburn/GLhf
 public void setEndPoint(Vector2 a_endPoint)
 {
     m_endPosition = new CartesianCoordinate(a_endPoint + m_endOffset);
 }
示例#19
0
文件: Line.cs 项目: melburn/GLhf
 public void setStartPoint(Vector2 a_startPoint)
 {
     m_startPosition = new CartesianCoordinate(a_startPoint + m_startOffset);
 }
示例#20
0
文件: Line.cs 项目: melburn/GLhf
 public void setEndPoint(Position a_position, Vector2 a_offset)
 {
     m_endPosition.setParentPosition(a_position);
     m_endOffset = a_offset;
 }
示例#21
0
文件: Line.cs 项目: melburn/GLhf
 public void setEndPoint(Position a_position)
 {
     m_endPosition = a_position;
 }
示例#22
0
 public PolarCoordinate(float a_radie, float a_slope, Position a_parent)
 {
     setLocalPolar(a_radie, a_slope);
     m_parentPosition = a_parent;
 }
示例#23
0
文件: Camera.cs 项目: theKyuu/GLhf
 public void setParentPosition(Position a_parent)
 {
     m_position.setParentPosition(a_parent);
 }
示例#24
0
文件: Rope.cs 项目: theKyuu/GLhf
 public void setLength(float a_length)
 {
     m_lenght = a_length;
     m_endPosition = new CartesianCoordinate(m_position.getGlobalCartesian() + new Vector2(0, (float)Math.Max(m_lenght, 72)));
 }
示例#25
0
 public PolarCoordinate(Vector2 a_coordinates, Position a_parentPosition)
 {
     m_coordinates = a_coordinates;
     m_parentPosition = a_parentPosition;
 }
示例#26
0
文件: Rope.cs 项目: theKyuu/GLhf
 public void setEndPoint(Position a_position)
 {
     m_endPosition = a_position;
     m_endPosition.setParentPositionWithoutMoving(m_startPosition);
     m_endPosition.plusXWith(36);
     m_line.setEndPoint(m_endPosition);
     m_lenght = m_line.getStartPoint().getDistanceTo(m_line.getEndPoint());
 }
示例#27
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 = getGlobalCartesianCoordinates();
     }
     else
     {
         m_coordinates = getGlobalCartesianCoordinates() - a_parentPosition.getGlobalCartesianCoordinates();
     }
     m_parentPosition = a_parentPosition;
 }
示例#28
0
 public PolarCoordinate(float a_radie, float a_slope, Position a_parent)
 {
     m_coordinates = new Vector2(a_radie, a_slope);
     m_parentPosition = a_parent;
 }
示例#29
0
 public virtual void setPosition(Position a_position)
 {
     m_position = a_position;
 }
示例#30
0
 public MovingObject(Position a_position, String a_sprite, float a_layer, float a_rotation = 0)
     : base(a_position, a_sprite, a_layer, a_rotation)
 {
 }