Class Animation

  • Direct Known Subclasses:
    UnitImageAnimation, UnitMoveAnimation

    public abstract class Animation
    extends java.lang.Object
    The base class for the animations. Note: we used to focus the map on the unit even when animation is off as long as the center-active-unit option was set. However IR#115 requested that if animation is off that we display nothing so as to speed up the other player moves as much as possible.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.List<java.awt.Point> points
      Positions for the unit label during the animation.
      protected java.util.List<Tile> tiles
      The tiles where the animation occurs.
      protected Unit unit
      The unit to animate.
    • Constructor Summary

      Constructors 
      Constructor Description
      Animation​(Unit unit, java.util.List<Tile> tiles)
      Make a new animation.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void executeWithLabel​(javax.swing.JLabel unitLabel, Animations.Procedure paintCallback)
      The code to be executed when a unit is out for animation.
      java.util.List<Tile> getTiles()
      Get the tiles where the animation occurs.
      Unit getUnit()
      Get the unit to animate.
      void setPoints​(java.util.List<java.awt.Point> points)
      Set the points for each tile.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • unit

        protected final Unit unit
        The unit to animate.
      • tiles

        protected final java.util.List<Tile> tiles
        The tiles where the animation occurs.
      • points

        protected java.util.List<java.awt.Point> points
        Positions for the unit label during the animation.
    • Constructor Detail

      • Animation

        public Animation​(Unit unit,
                         java.util.List<Tile> tiles)
        Make a new animation.
        Parameters:
        unit - The Unit to be animated.
        tiles - A list of Tiles where the animation occurs.
    • Method Detail

      • getUnit

        public Unit getUnit()
        Get the unit to animate.
        Returns:
        The Unit.
      • getTiles

        public java.util.List<Tile> getTiles()
        Get the tiles where the animation occurs.
        Returns:
        A list of Tiles.
      • setPoints

        public void setPoints​(java.util.List<java.awt.Point> points)
        Set the points for each tile.
        Parameters:
        points - A list of Points to position the animation label.
      • executeWithLabel

        public abstract void executeWithLabel​(javax.swing.JLabel unitLabel,
                                              Animations.Procedure paintCallback)
        The code to be executed when a unit is out for animation.
        Parameters:
        unitLabel - A JLabel with an image of the unit to animate.
        paintCallback - A callback to request that the animation area be repainted.