Package net.sf.gridarta.model.gameobject
Class DefaultIsoGameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
- java.lang.Object
-
- net.sf.gridarta.model.baseobject.GameObjectContainer<G,A,R>
-
- net.sf.gridarta.model.baseobject.AbstractBaseObject<G,A,R,G>
-
- net.sf.gridarta.model.gameobject.AbstractGameObject<G,A,R>
-
- net.sf.gridarta.model.gameobject.DefaultIsoGameObject<G,A,R>
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<G>,Attributes,BaseObject<G,A,R,G>,GameObject<G,A,R>
- Direct Known Subclasses:
GameObject,GameObject
public abstract class DefaultIsoGameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends AbstractGameObject<G,A,R>
Default implementation forGameObjectimplementing classes.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static @NotNull java.lang.StringALIGNThe name of the "align" attribute.static @NotNull java.lang.StringALPHAThe name of the "alpha" attribute.protected static @NotNull java.lang.StringDRAW_DOUBLEThe name of the "draw_double" attribute.protected static @NotNull java.lang.StringDRAW_DOUBLE_ALWAYSThe name of the "draw_double_always" attribute.protected static @NotNull java.lang.StringGLOW_RADIUSThe name of the "glow_radius" attribute.static @NotNull java.lang.StringLAYERThe name of the "layer" attribute.static intMAX_SUB_LAYERSstatic @NotNull java.lang.StringROTATEThe name of the "rotate" attribute.static @NotNull java.lang.StringSUB_LAYERThe name of the "sub_layer" attribute.static @NotNull java.lang.StringSYS_OBJECTThe name of the "sys_object" attribute.static @NotNull java.lang.StringZThe name of the "z" attribute.static @NotNull java.lang.StringZOOMThe name of the "zoom" attribute.-
Fields inherited from interface net.sf.gridarta.model.baseobject.BaseObject
ANIM_SPEED, ANIMATION, BLOCKSVIEW, DIRECTION, EDIT_TYPE_NONE, FACE, HP, IS_ANIMATED, IS_TURNABLE, LAST_HEAL, LEVEL, NAME, NO_PASS, NO_PICK, SLAYING, SP, TITLE, TYPE
-
Fields inherited from interface net.sf.gridarta.model.gameobject.GameObject
EDITOR_FOLDER_INTERN
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultIsoGameObject(R archetype, @NotNull FaceObjectProviders faceObjectProviders, @NotNull AnimationObjects animationObjects)Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Gclone()Creates a clone of this base object.voidfacesReloaded()Will be called whenever the archetype faces have been reloaded.@NotNull javax.swing.IcongetDoubleImage()Returns a double variant of the face for this GameObject.@NotNull javax.swing.IcongetStretchedImage(long stretchFactor)Returns a stretched variant of the face for this floor-type GameObject.longgetStretchFactor()Acquire stretch factor of the object.@NotNull javax.swing.IcongetTransparentDoubleImage()Returns a transparent variant of the face for this GameObject.@NotNull javax.swing.IcongetTransparentImage()Returns a transparent variant of the face for this GameObject.intgetYOffset()Acquire Y offset of the object for rendering purposes.abstract booleanisDrawDouble(boolean drawDoubleFaces)Returns whether to draw this game object with double height.booleanisEqual(@NotNull BaseObject<?,?,?,?> gameObject)Compares this object to another game object.abstract booleanisStretched(boolean tileStretching)Returns whether to draw this game object with stretching transformation.voidrefreshStretchFactor()Invalidates stretch factor value calculated bygetStretchFactor()and clears the stored stretched face.voidsetObjectFace()We set here the real face of the objects, depending on the set face and the set animation.booleanusesDirection()Return whether this base object uses the "direction" attribute.-
Methods inherited from class net.sf.gridarta.model.gameobject.AbstractGameObject
asGameObject, getArchetype, getAttributeString, getContainer, getContainerGameObject, getEffectiveFaceName, getMapSquare, getMapSquareOptional, getNext, getPrev, getTopContainer, hasUndefinedArchetype, insertAfter, insertBefore, isBottom, isInContainer, isTop, markModified, moveBottom, moveDown, moveTop, moveUp, newInstance, notifyBeginChange, notifyEndChange, notifyTransientChange, remove, setArchetype, setContainer, visit
-
Methods inherited from class net.sf.gridarta.model.baseobject.AbstractBaseObject
addMsgTextLine, addObjectText, addTailPart, beginGameObjectChange, countInvObjects, endGameObjectChange, getAnimName, getAttributeDouble, getAttributeDouble, getAttributeInt, getAttributeInt, getAttributeKeys, getAttributeLong, getAttributeLong, getAttributeString, getAttributeValue, getBestName, getDirection, getEditType, getFaceName, getFaceObjName, getFaceObjSource, getHead, getLoreText, getMapLocation, getMapX, getMapY, getMaxX, getMaxY, getMinX, getMinY, getMsgText, getMulti, getMultiNext, getMultiRefCount, getNormalImage, getObjectText, getObjName, getSizeX, getSizeY, getThis, getTypeNo, hasAttribute, hasAttribute, isDefaultGameObject, isHead, isMulti, isTail, removeAttribute, removeTailParts, setAttributeInt, setAttributeString, setEditType, setLoreText, setMapX, setMapY, setMsgText, setMulti, setObjectText, setThisContainer, toString, updateArchetype
-
Methods inherited from class net.sf.gridarta.model.baseobject.GameObjectContainer
addFirst, addLast, getFirst, getLast, getNext, getPrev, hasSameContents, insertAfter, insertBefore, isBottom, isEmpty, isTop, iterator, moveBottom, moveDown, moveTop, moveUp, recursive, remove, removeAll, replace, reverse, toString
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.gridarta.model.baseobject.Attributes
getAttributeDouble, getAttributeInt, getAttributeLong, getAttributeString, hasAttribute, removeAttribute, setAttributeInt
-
Methods inherited from interface net.sf.gridarta.model.baseobject.BaseObject
addMsgTextLine, addObjectText, addTailPart, countInvObjects, getAnimName, getAttributeDouble, getAttributeInt, getAttributeLong, getBestName, getDirection, getEditType, getFaceName, getFaceObjName, getFaceObjSource, getHead, getLoreText, getMapLocation, getMapX, getMapY, getMaxX, getMaxY, getMinX, getMinY, getMsgText, getMultiNext, getMultiRefCount, getNormalImage, getObjectText, getObjName, getSizeX, getSizeY, getTypeNo, hasAttribute, isDefaultGameObject, isHead, isMulti, isTail, removeTailParts, setAttributeString, setEditType, setLoreText, setMapX, setMapY, setMsgText, setMulti, setObjectText, toString
-
Methods inherited from interface net.sf.gridarta.model.gameobject.GameObject
addFirst, addLast, applyMassChange, getFirst, getLast, getLightRadius, isEmpty, isScripted, iterator, propagateElevation, recursive, removeAll, reverse, updateTileStretch
-
-
-
-
Field Detail
-
MAX_SUB_LAYERS
public static final int MAX_SUB_LAYERS
- See Also:
- Constant Field Values
-
Z
@NotNull public static final @NotNull java.lang.String Z
The name of the "z" attribute.- See Also:
- Constant Field Values
-
LAYER
@NotNull public static final @NotNull java.lang.String LAYER
The name of the "layer" attribute.- See Also:
- Constant Field Values
-
SUB_LAYER
@NotNull public static final @NotNull java.lang.String SUB_LAYER
The name of the "sub_layer" attribute.- See Also:
- Constant Field Values
-
SYS_OBJECT
@NotNull public static final @NotNull java.lang.String SYS_OBJECT
The name of the "sys_object" attribute.- See Also:
- Constant Field Values
-
DRAW_DOUBLE_ALWAYS
@NotNull protected static final @NotNull java.lang.String DRAW_DOUBLE_ALWAYS
The name of the "draw_double_always" attribute.- See Also:
- Constant Field Values
-
DRAW_DOUBLE
@NotNull protected static final @NotNull java.lang.String DRAW_DOUBLE
The name of the "draw_double" attribute.- See Also:
- Constant Field Values
-
ALIGN
@NotNull public static final @NotNull java.lang.String ALIGN
The name of the "align" attribute.- See Also:
- Constant Field Values
-
ZOOM
@NotNull public static final @NotNull java.lang.String ZOOM
The name of the "zoom" attribute.- See Also:
- Constant Field Values
-
ALPHA
@NotNull public static final @NotNull java.lang.String ALPHA
The name of the "alpha" attribute.- See Also:
- Constant Field Values
-
ROTATE
@NotNull public static final @NotNull java.lang.String ROTATE
The name of the "rotate" attribute.- See Also:
- Constant Field Values
-
GLOW_RADIUS
@NotNull protected static final @NotNull java.lang.String GLOW_RADIUS
The name of the "glow_radius" attribute.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultIsoGameObject
protected DefaultIsoGameObject(@NotNull R archetype, @NotNull @NotNull FaceObjectProviders faceObjectProviders, @NotNull @NotNull AnimationObjects animationObjects)Creates a new instance.- Parameters:
archetype- the base archetypefaceObjectProviders- the face object providers for looking up facesanimationObjects- the animation objects for looking up animations
-
-
Method Detail
-
usesDirection
public boolean usesDirection()
Description copied from interface:BaseObjectReturn whether this base object uses the "direction" attribute.- Returns:
- whether this base object uses the "direction" attribute
-
setObjectFace
public void setObjectFace()
Description copied from interface:BaseObjectWe set here the real face of the objects, depending on the set face and the set animation. The rule is, that a active animation will overrule the default face. We will catch it here. This method should always be invoked after the face or animation has changed and no other change is expected right now, so the changes to animation / face should be applied.- Specified by:
setObjectFacein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>- Overrides:
setObjectFacein classAbstractBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>
-
getTransparentImage
@NotNull public @NotNull javax.swing.Icon getTransparentImage()
Returns a transparent variant of the face for this GameObject.- Returns:
- the transparent face for this game object
-
getDoubleImage
@NotNull public @NotNull javax.swing.Icon getDoubleImage()
Returns a double variant of the face for this GameObject.- Returns:
- the double face for this game object
-
getTransparentDoubleImage
@NotNull public @NotNull javax.swing.Icon getTransparentDoubleImage()
Returns a transparent variant of the face for this GameObject.- Returns:
- the transparent face for this game object
-
getYOffset
public final int getYOffset()
Acquire Y offset of the object for rendering purposes.- Returns:
- the y offset.
-
refreshStretchFactor
public final void refreshStretchFactor()
Invalidates stretch factor value calculated bygetStretchFactor()and clears the stored stretched face.
-
getStretchFactor
public final long getStretchFactor()
Acquire stretch factor of the object. As the calculation is costly, the value will be stored until the next call torefreshStretchFactor()- Returns:
- the stretch factor
-
getStretchedImage
@NotNull public @NotNull javax.swing.Icon getStretchedImage(long stretchFactor)
Returns a stretched variant of the face for this floor-type GameObject.- Returns:
- the stretched face for this game object
-
isDrawDouble
public abstract boolean isDrawDouble(boolean drawDoubleFaces)
Returns whether to draw this game object with double height.- Parameters:
drawDoubleFaces- whether the "draw double faces" map view setting is enabled- Returns:
- whether to draw this game object with double height
-
isStretched
public abstract boolean isStretched(boolean tileStretching)
Returns whether to draw this game object with stretching transformation.- Parameters:
tileStretching- whether the "tile-stretching" map view setting is enabled- Returns:
- whether to draw this game object with stretching transformation
-
clone
@NotNull public G clone()
Description copied from interface:BaseObjectCreates a clone of this base object.- Specified by:
clonein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>- Overrides:
clonein classAbstractGameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
-
isEqual
public boolean isEqual(@NotNull @NotNull BaseObject<?,?,?,?> gameObject)Description copied from interface:BaseObjectCompares this object to another game object.- Specified by:
isEqualin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>- Overrides:
isEqualin classAbstractBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>- Parameters:
gameObject- the other game object- Returns:
trueif this object equals the other object
-
facesReloaded
public void facesReloaded()
Description copied from interface:BaseObjectWill be called whenever the archetype faces have been reloaded.- Specified by:
facesReloadedin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>- Overrides:
facesReloadedin classAbstractBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>
-
-