/////////////////////////////////////////////// //////////////////PROPERTIES/////////////////// /////////////////////////////////////////////// /*********************************************/ /////////////////////////////////////////////// ////////////////////METHODS//////////////////// /////////////////////////////////////////////// //////////////TRANSFORM_METHODS//////////////// public override void moveTo(float x, float y) { float oldX = systemCenter.X, oldY = systemCenter.Y; if (OnMoveStart != null) { if (!OnMoveStart.Invoke(this, oldX, oldY)) { return; } } if (OnMoving != null) { OnMoving.Invoke(this, oldX, oldY); } GlVectorR2 moveVector = new GlVectorR2(x - this.systemCenter.X, y - this.systemCenter.Y); this.systemCenter = new GlPointR2(x, y); foreach (GlFigure F in this.figuresAmount) { GlPointR2 newCenter = moveVector.fromPointToPoint(F.Center); F.moveTo(newCenter.X, newCenter.Y); } if (OnMoved != null) { OnMoving.Invoke(this, oldX, oldY); } }
/////////////////////////////////////////////// //////////////////PROPERTIES/////////////////// /////////////////////////////////////////////// /*********************************************/ /////////////////////////////////////////////// ////////////////////METHODS//////////////////// /////////////////////////////////////////////// //////////////TRANSFORM_METHODS//////////////// public override void moveTo(float x, float y) { if (OnMoveStart != null) { if (!OnMoveStart.Invoke(this, this.x, this.y)) { return; } } if (OnMoving != null) { OnMoving.Invoke(this, this.x, this.y); } float oldX = this.x, oldy = this.y; this.X = x; this.Y = y; if (OnMoved != null) { OnMoved.Invoke(this, oldX, oldy); } }
/////////////////////////////////////////////// //////////////////PROPERTIES/////////////////// /////////////////////////////////////////////// /*********************************************/ /////////////////////////////////////////////// ////////////////////METHODS//////////////////// /////////////////////////////////////////////// //////////////TRANSFORM_METHODS//////////////// public override void moveTo(float x, float y) { float oldX = this.Center.X; float oldY = this.Center.Y; if (OnMoveStart != null) { if (!OnMoveStart.Invoke(this, oldX, oldY)) { return; } } if (OnMoving != null) { OnMoving.Invoke(this, oldX, oldY); } this.systemCenter = new GlPointR2(x, y); updatePointsPosition(); if (OnMoved != null) { OnMoved.Invoke(this, oldX, oldY); } }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (isDown) { if (Dir == Direction.Horizontal) { if (e.X - downPoint.X > this.Height) { OnMoving?.Invoke(this, new BlockMoveArgs(MoveDir.Right)); } else if (downPoint.X - e.X > this.Height) { OnMoving?.Invoke(this, new BlockMoveArgs(MoveDir.Left)); } } else { if (e.Y - downPoint.Y > this.Width) { OnMoving?.Invoke(this, new BlockMoveArgs(MoveDir.Down)); } else if (downPoint.Y - e.Y > this.Width) { OnMoving?.Invoke(this, new BlockMoveArgs(MoveDir.Up)); } } } }
/////////////////////////////////////////////// //////////////////PROPERTIES/////////////////// /////////////////////////////////////////////// /*********************************************/ /////////////////////////////////////////////// ////////////////////METHODS//////////////////// /////////////////////////////////////////////// //////////////TRANSFORM_METHODS//////////////// public override void moveTo(float x, float y) { if (OnMoveStart != null) { if (!OnMoveStart.Invoke(this, this.polyCenter.X, this.polyCenter.Y)) { return; } } if (OnMoving != null) { OnMoving.Invoke(this, this.polyCenter.X, this.polyCenter.Y); } GlVectorR2 delta = new GlVectorR2(x - polyCenter.X, y - polyCenter.Y); for (int i = 0; i < vertexes.Length; i++) { vertexes[i] = delta.fromPointToPoint(vertexes[i]); } GlPointR2 OP = new GlPointR2(this.polyCenter); this.polyCenter = new GlPointR2(x, y); if (OnMoved != null) { OnMoved.Invoke(this, OP.X, OP.Y); } }
/////////////////////////////////////////////// //////////////////PROPERTIES/////////////////// /////////////////////////////////////////////// /*********************************************/ /////////////////////////////////////////////// ////////////////////METHODS//////////////////// /////////////////////////////////////////////// //////////////TRANSFORM_METHODS//////////////// public void moveTo(GlPointR2 newBelongsPoint) { if (newBelongsPoint == null || newBelongsPoint.isNullPoint()) { return; } if (OnMoveStart != null) { if (!OnMoveStart.Invoke(this, this.pointOfLine.X, this.pointOfLine.Y)) { return; } } if (OnMoving != null) { OnMoving.Invoke(this, this.pointOfLine.X, this.pointOfLine.Y); } GlPointR2 OP = new GlPointR2(this.PointOfLine); this.pointOfLine = newBelongsPoint; if (OnMoved != null) { OnMoved.Invoke(this, OP.X, OP.Y); } }
/// <summary> /// Updates a move operation based of the provided position. <see cref="OnMoving"/> /// </summary> /// <returns>True if a move operation is running.</returns> public bool Drag(float x, float y) { if (!IsMoving) { return(false); } float dx = x - originX; float dy = y - originY; float nx = originalSelection.X + dx; float ny = originalSelection.Y + dy; Selection = new RectangleF(nx, ny, Selection.Width, Selection.Height); foreach (TransformerItem item in items) { item.Item.X = item.OriginX + dx; item.Item.Y = item.OriginY + dy; } OnMoving?.Invoke(this, EventArgs.Empty); return(true); }
public virtual void MoveTo(PositionInGrid direction) { Board.ElementMoveTo(this, direction.x, direction.y); if (AudioSource && MoveSound) { AudioSource.clip = MoveSound; AudioSource.Play(); } OnMoving?.Invoke(this); transform.position += new Vector3(direction.x, direction.y); }
private void FixedUpdate() { OnMovingArgs args = new OnMovingArgs(movement + (AddGravity ? Physics.gravity : Vector3.zero)); if (OnMoving != null) { OnMoving.Invoke(this, args); } if (!args.Cancel) { physics.velocity = (args.Velocity * MovementMultiplicator); movement = Vector3.zero; } }
public virtual void OnMouseMove(MouseEventArgs e) { if (!_enabled) { return; } if (Moving) { Point tempPoint = CMain.MPoint.Subtract(_movePoint); if (Parent == null) { if (tempPoint.Y + TrueSize.Height > Settings.ScreenHeight) { tempPoint.Y = Settings.ScreenHeight - TrueSize.Height - 1; } if (tempPoint.X + TrueSize.Width > Settings.ScreenWidth) { tempPoint.X = Settings.ScreenWidth - TrueSize.Width - 1; } } else { if (tempPoint.Y + TrueSize.Height > Parent.TrueSize.Height) { tempPoint.Y = Parent.TrueSize.Height - TrueSize.Height; } if (tempPoint.X + TrueSize.Width > Parent.TrueSize.Width) { tempPoint.X = Parent.TrueSize.Width - TrueSize.Width; } } if (tempPoint.X < 0) { tempPoint.X = 0; } if (tempPoint.Y < 0) { tempPoint.Y = 0; } Location = tempPoint; if (OnMoving != null) { OnMoving.Invoke(this, e); } return; } if (Controls != null) { for (int i = Controls.Count - 1; i >= 0; i--) { if (Controls[i].IsMouseOver(CMain.MPoint)) { Controls[i].OnMouseMove(e); return; } } } Highlight(); if (MouseMove != null) { MouseMove.Invoke(this, e); } }
private void OnMove(InputValue inputValue) { OnMoving?.Invoke(inputValue.Get <float>()); }
private void Moving(float inputAxis) { // TODO: Moving Implement Here OnMoving?.Invoke(); }