public override void Show(Ship ship, Character character) { int numberofpoints = 0; for (int i = Owner.point; i < Owner.Elements.Count; i++) { if (Owner.Elements[i] is PointElement) numberofpoints++; else break; } int t_diff = Environment.TickCount - Owner.LastTick; if (numberofpoints > 1 && t_diff > -1) { WaypointStructure current = new WaypointStructure(ship.Position, ship.Yaw); PointElement A = Owner.Elements[Owner.point + 0] as PointElement; PointElement B = Owner.Elements[Owner.point + 1] as PointElement; ship.WideMovement(character, current, A.structure, B.structure); } else if (numberofpoints > 0 && t_diff > -1) { WaypointStructure current = new WaypointStructure(ship.Position, ship.Yaw); PointElement A = Owner.Elements[Owner.point + 0] as PointElement; ship.WideMovement(character, current, A.structure); } }
public override void Check(Ship ship) { int tdiff = Environment.TickCount - Owner.LastTick; if (Owner.state == 0) { if (tdiff > 1000) { UpdateMovment(tdiff, ship); int speed = (int)ship.Status.WalkingSpeed; double distance = ComputeDistance(ship); if (distance < speed) { int t_add = (int)((distance / (double)speed) * 1000); ship.Yaw = this.structure.rotation; ship.Position = this.structure.point; Owner.LastTick = Environment.TickCount + t_add; Owner.NextPoint(ship); Owner.state = 1; } else { Owner.LastTick = Environment.TickCount; } } } else { if (tdiff > 0) { UpdateMovment(tdiff, ship); Regiontree.UpdateRegion(ship, false); int numberofpoints = 0; for (int i = Owner.point; i < Owner.Elements.Count; i++) { if (Owner.Elements[i] is PointElement) numberofpoints++; else break; } Owner.state = 0; if (numberofpoints > 1) { WaypointStructure current = new WaypointStructure(ship.Position, ship.Yaw); PointElement A = Owner.Elements[Owner.point + 0] as PointElement; PointElement B = Owner.Elements[Owner.point + 1] as PointElement; ship.WideMovement(current, A.structure, B.structure); } } } }