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()); }
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); }
public Camera() { m_zoom = 1.0f; m_rotation = 0.0f; m_position = new CartesianCoordinate(Vector2.Zero); load(); }
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()); }
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(); }
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); }
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(); }
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()))); }
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(); }
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; }
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(); }
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; }
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(); }
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; }
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; }
public CartesianCoordinate(Vector2 a_offset, Position a_parentPosition) { m_coordinates = a_offset; m_parentPosition = a_parentPosition; }
public Entity(Position a_position, String a_sprite, float a_layer, float a_rotation = 0) : base(a_position, a_sprite, a_layer, a_rotation) { }
public void setEndPoint(Vector2 a_endPoint) { m_endPosition = new CartesianCoordinate(a_endPoint + m_endOffset); }
public void setStartPoint(Vector2 a_startPoint) { m_startPosition = new CartesianCoordinate(a_startPoint + m_startOffset); }
public void setEndPoint(Position a_position, Vector2 a_offset) { m_endPosition.setParentPosition(a_position); m_endOffset = a_offset; }
public void setEndPoint(Position a_position) { m_endPosition = a_position; }
public PolarCoordinate(float a_radie, float a_slope, Position a_parent) { setLocalPolar(a_radie, a_slope); m_parentPosition = a_parent; }
public void setParentPosition(Position a_parent) { m_position.setParentPosition(a_parent); }
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))); }
public PolarCoordinate(Vector2 a_coordinates, Position a_parentPosition) { m_coordinates = a_coordinates; m_parentPosition = a_parentPosition; }
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()); }
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; }
public PolarCoordinate(float a_radie, float a_slope, Position a_parent) { m_coordinates = new Vector2(a_radie, a_slope); m_parentPosition = a_parent; }
public virtual void setPosition(Position a_position) { m_position = a_position; }
public MovingObject(Position a_position, String a_sprite, float a_layer, float a_rotation = 0) : base(a_position, a_sprite, a_layer, a_rotation) { }