public override void Reflect(int start, int end, Level.ReflectionOrientation ref_or) { base.Reflect(start, end, ref_or); if (is_reflectable && ((ref_or == Level.ReflectionOrientation.HORIZONTAL && DiscY >= start && DiscY <= end) || (ref_or == Level.ReflectionOrientation.VERTICAL && DiscX >= start && DiscX <= end) || ref_or == Level.ReflectionOrientation.DIAGONAL)) { UpdateDirection(ref_or, start); SetTextureAccordingToDirection(); } }
public void UpdateDirection(Level.ReflectionOrientation ref_or, int diagonal_line_pos) { switch (this.direction) { case Direction.Up: if (ref_or == Level.ReflectionOrientation.HORIZONTAL) { this.direction = Direction.Down; } else if (ref_or == Level.ReflectionOrientation.DIAGONAL && diagonal_line_pos == 1) { this.direction = Direction.Left; } else if (ref_or == Level.ReflectionOrientation.DIAGONAL && diagonal_line_pos == -1) { this.direction = Direction.Right; } break; case Direction.Right: if (ref_or == Level.ReflectionOrientation.VERTICAL) { this.direction = Direction.Left; } else if (ref_or == Level.ReflectionOrientation.DIAGONAL && diagonal_line_pos == 1) { this.direction = Direction.Down; } else if (ref_or == Level.ReflectionOrientation.DIAGONAL && diagonal_line_pos == -1) { this.direction = Direction.Up; } break; case Direction.Down: if (ref_or == Level.ReflectionOrientation.HORIZONTAL) { this.direction = Direction.Up; } else if (ref_or == Level.ReflectionOrientation.DIAGONAL && diagonal_line_pos == 1) { this.direction = Direction.Right; } else if (ref_or == Level.ReflectionOrientation.DIAGONAL && diagonal_line_pos == -1) { this.direction = Direction.Left; } break; case Direction.Left: if (ref_or == Level.ReflectionOrientation.VERTICAL) { this.direction = Direction.Right; } else if (ref_or == Level.ReflectionOrientation.DIAGONAL && diagonal_line_pos == 1) { this.direction = Direction.Up; } else if (ref_or == Level.ReflectionOrientation.DIAGONAL && diagonal_line_pos == -1) { this.direction = Direction.Down; } break; } }