public override void update() { Src_Rect = new Rectangle(8 + (Team - 1) * 24, Flash_Frame * 16, 16, 16); Dot_Src_Rect = new Rectangle((Team - 1) * 24, 8 + Flash_Frame * 16, 8, 8); if (Length < Total_Length) { Length += Movement_Speed; } else { Length = Total_Length; } for (int i = 0; i < Points.Length; i++) { Points[i] = point_along_route((Length * i) / Points.Length, Waypoints); } loc = point_along_route(Length, Waypoints); float arrow_angle = angle_along_route(Length + Movement_Speed * 4, Waypoints); if (angle != arrow_angle) { if (Math.Abs(arrow_angle - angle) > MathHelper.Pi) { if (angle < 0) { angle += MathHelper.TwoPi; } else if (angle > 0) { angle -= MathHelper.TwoPi; } } angle = (float)Additional_Math.double_closer(angle, arrow_angle, ARROW_TURN_SPEED); } }
public void set_loc(Vector2 new_loc) { Locs.Clear(); Locs.Add((loc * Ratio[0] + new_loc * Ratio[1]) / (Ratio[0] + Ratio[1])); for (; ;) { // X if (Math.Abs(Locs[Locs.Count - 1].X - new_loc.X) <= Min_Distance_X) { Locs[Locs.Count - 1] = new Vector2(new_loc.X, Locs[Locs.Count - 1].Y); } else if (Math.Abs(Locs[Locs.Count - 1].X - new_loc.X) <= Override_Distance_X) { Locs[Locs.Count - 1] = new Vector2( (float)Additional_Math.double_closer(Locs[Locs.Count - 1].X, new_loc.X, Min_Distance_X), Locs[Locs.Count - 1].Y); } // Y if (Math.Abs(Locs[Locs.Count - 1].Y - new_loc.Y) <= Min_Distance_Y) { Locs[Locs.Count - 1] = new Vector2(Locs[Locs.Count - 1].X, new_loc.Y); } else if (Math.Abs(Locs[Locs.Count - 1].Y - new_loc.Y) <= Override_Distance_Y) { Locs[Locs.Count - 1] = new Vector2( Locs[Locs.Count - 1].X, (float)Additional_Math.double_closer(Locs[Locs.Count - 1].Y, new_loc.Y, Min_Distance_Y)); } if (Locs[Locs.Count - 1].X == new_loc.X && Locs[Locs.Count - 1].Y == new_loc.Y) { break; } Locs.Add((new Vector2(Locs[Locs.Count - 1].X, Locs[Locs.Count - 1].Y) * Ratio[0] + new_loc * Ratio[1]) / (Ratio[0] + Ratio[1])); } }
private void update_input(float max_speed) { if (Active) { if (Global.Input.pressed(Inputs.Up)) { if (Scroll_Speed > 0) { Scroll_Speed = 0; } if (Scroll_Speed > -max_speed) { Scroll_Speed--; } return; } else if (Global.Input.pressed(Inputs.Down)) { if (Scroll_Speed < 0) { Scroll_Speed = 0; } if (Scroll_Speed < max_speed) { Scroll_Speed++; } return; } else if (Global.Input.mouseScroll < 0) { Scroll_Speed += max_speed / 5; ScrollWheel = true; return; } else if (Global.Input.mouseScroll > 0) { Scroll_Speed += -max_speed / 5; ScrollWheel = true; return; } else if (Input.ControlScheme == ControlSchemes.Mouse && UpArrow.MouseOver()) { Scroll_Speed = -Config.CONVO_BACKLOG_MAX_SCROLL_SPEED; ScrollWheel = false; return; } else if (Input.ControlScheme == ControlSchemes.Mouse && DownArrow.MouseOver()) { Scroll_Speed = Config.CONVO_BACKLOG_MAX_SCROLL_SPEED; ScrollWheel = false; return; } else if (Global.Input.gesture_triggered(TouchGestures.VerticalDrag)) { Scroll_Speed = -(int)Global.Input.verticalDragVector.Y; return; } } if (Scroll_Speed != 0) { if (Input.ControlScheme == ControlSchemes.Buttons) { Scroll_Speed = (float)Additional_Math.double_closer( Scroll_Speed, 0, 1); } else if (Input.ControlScheme == ControlSchemes.Mouse) { if (ScrollWheel) { Scroll_Speed *= (float)Math.Pow( Config.CONVO_BACKLOG_TOUCH_SCROLL_FRICTION, 2f); } else { Scroll_Speed = (float)Additional_Math.double_closer( Scroll_Speed, 0, 1); } } else { Scroll_Speed *= Config.CONVO_BACKLOG_TOUCH_SCROLL_FRICTION; } if (Math.Abs(Scroll_Speed) < 0.1f) { Scroll_Speed = 0; ScrollWheel = false; } } }