Class StaticShadow

All Implemented Interfaces:
EntityRenderedListener, EntityRenderListener, IEntity, Tweenable, EventListener

public class StaticShadow extends MapArea
  • Field Details

    • DEFAULT_COLOR

      public static final Color DEFAULT_COLOR
    • DEFAULT_OFFSET

      public static final int DEFAULT_OFFSET
      See Also:
  • Constructor Details

    • StaticShadow

      public StaticShadow(StaticShadowType shadowType, int offset)
      Instantiates a new StaticShadow entity.
      Parameters:
      shadowType - The type of the static shadow.
      offset - The offset for the shadow.
    • StaticShadow

      public StaticShadow(StaticShadowType shadowType)
      Instantiates a new StaticShadow entity.
      Parameters:
      shadowType - The type of the static shadow.
    • StaticShadow

      public StaticShadow(double x, double y, float width, float height, StaticShadowType shadowType)
      Instantiates a new StaticShadow entity.
      Parameters:
      x - The x-coordinate of this instance.
      y - The y-coordinate of this instance.
      width - The width of this instance.
      height - The height of this instance.
      shadowType - The type of the static shadow.
    • StaticShadow

      public StaticShadow(int id, double x, double y, float width, float height, StaticShadowType shadowType)
      Instantiates a new StaticShadow entity.
      Parameters:
      id - The id of this entity.
      x - The x-coordinate of this instance.
      y - The y-coordinate of this instance.
      width - The width of this instance.
      height - The height of this instance.
      shadowType - The type of the static shadow.
    • StaticShadow

      public StaticShadow(int id, String name, double x, double y, float width, float height, StaticShadowType shadowType)
      Instantiates a new StaticShadow entity.
      Parameters:
      id - The id of this entity.
      name - The name of this entity.
      x - The x-coordinate of this instance.
      y - The y-coordinate of this instance.
      width - The width of this instance.
      height - The height of this instance.
      shadowType - The type of the static shadow.
    • StaticShadow

      public StaticShadow(CollisionBox collisionBox)
      Instantiates a new StaticShadow entity.
      Parameters:
      collisionBox - The collision box from which this shadow instance originates from.
  • Method Details

    • getShadowType

      public StaticShadowType getShadowType()
      Gets the type of the static shadow.
      Returns:
      the current shadow type.
    • setShadowType

      public void setShadowType(StaticShadowType shadowType)
      Sets the type of the static shadow and invalidates the current area.
      Parameters:
      shadowType - the new shadow type to set.
    • setX

      public void setX(double x)
      Description copied from interface: IEntity
      Sets the X coordinate of the entity.
      Specified by:
      setX in interface IEntity
      Overrides:
      setX in class Entity
      Parameters:
      x - The new X coordinate of the entity.
    • setY

      public void setY(double y)
      Description copied from interface: IEntity
      Sets the Y coordinate of the entity.
      Specified by:
      setY in interface IEntity
      Overrides:
      setY in class Entity
      Parameters:
      y - The new Y coordinate of the entity.
    • setWidth

      public void setWidth(double width)
      Description copied from interface: IEntity
      Sets the width of the entity.
      Specified by:
      setWidth in interface IEntity
      Overrides:
      setWidth in class Entity
      Parameters:
      width - The new width of the entity.
    • setHeight

      public void setHeight(double height)
      Description copied from interface: IEntity
      Sets the height of the entity.
      Specified by:
      setHeight in interface IEntity
      Overrides:
      setHeight in class Entity
      Parameters:
      height - The new height of the entity.
    • setLocation

      public void setLocation(Point2D location)
      Description copied from class: Entity
      Sets the map location.
      Specified by:
      setLocation in interface IEntity
      Overrides:
      setLocation in class Entity
      Parameters:
      location - the new map location
    • getOrigin

      public CollisionBox getOrigin()
      Gets the origin collision box of this static shadow.
      Returns:
      the origin collision box, or null if there is no origin.
    • toString

      public String toString()
      Returns a string representation of this static shadow. If the origin is not null, the string representation includes the origin's string representation.
      Overrides:
      toString in class Entity
      Returns:
      a string representation of this static shadow.
    • getArea

      public Area getArea()
      Gets the area of the static shadow. If the shadow type is NONE, returns null. If the area is not already created, it calls the createArea() method to generate it.
      Returns:
      the area of the static shadow, or null if the shadow type is NONE.
    • getOffset

      public int getOffset()
      Gets the offset for the shadow.
      Returns:
      the shadow offset.
    • setOffset

      public void setOffset(int shadowOffset)
      Sets the offset for the shadow and invalidates the current area.
      Parameters:
      shadowOffset - the new shadow offset to set.