Package com.starpoints.game
Class Fog
- java.lang.Object
-
- com.starpoints.game.Thing
-
- com.starpoints.game.Fog
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public abstract class Fog extends Thing implements java.io.Serializable
Abstract baseclass for all fogs on the field. A Fog is attached to one point independently of items or figures on that point. Fogs might have an effect when entering, when staying in or when leaving a fog.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected FieldfieldThe field the fog is on.-
Fields inherited from class com.starpoints.game.Thing
DEBUG, energy, energyFx, energyMaxSoundPlayed, energyModifications, explosionCounter, game, imageName, innerColor, invulnCount, isAffectedByBlack, isAffectedByGray, level, MAX_TEXTPAINT, maxEnergy, nextID, outerColor, p, shieldCount, status, text
-
-
Constructor Summary
Constructors Constructor Description Fog()Creates a fog on the field.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ThingStatecreateState(AnimationInfo animation)Creates a state object for this item.static FoggetFog(java.lang.Class c)Gets a fog of the given class.static FoggetFog(java.lang.String classname)Gets a fog of the given class.protected intgetImageIndex(AnimationInfo animation)Gets the fog image index.abstract java.lang.StringgetImageName(AnimationInfo animation)Gets an image name for the fog.java.lang.StringgetName()Returns a display name for the thing.protected intgetRandomImageIndex(int max)Gets a random image index.protected voidonEnemyKilled(Figure figure, int roundCount, DieReason reason, AnimationInfo animation)Called, if something is killed by the fog.protected abstract voidperformEnterEffect(Thing t, AnimationInfo animation)Called, if a thing enters (or is placed on) the fog.protected abstract voidperformLeaveEffect(Thing t, AnimationInfo animation)Called, if a thing leaves the fog.protected abstract voidperformStayEffect(Thing t, AnimationInfo animation)Called, if a thing stays in the fog.voidsetName(java.lang.String name)java.lang.StringtoString()Returns a String represantation for this point containing this points coordinatesprotected voidupdateExplodingStatus(AnimationInfo animation)Handles the fogs status during update phase of the round when thing is exploding.-
Methods inherited from class com.starpoints.game.Thing
addEnergy, addShielding, addStateProperties, affectsBlue, clearTexts, die, displayText, displayText, entersColor, equals, getColor, getEnergy, getEnergyMaxCount, getExplosionCounter, getField, getGame, getID, getInnerColor, getInvulnerableRounds, getLevel, getMaxEnergy, getNextID, getOuterColor, getPoint, getShadowColor, getShield, getStateObject, getStatus, getText, getTextColor, getTextPaintCount, getX, getY, hashCode, invulnerable, isAffectedByBlack, isAffectedByGray, isDestroyed, isExploding, isInvulnerable, isOK, isShowingEnergyFx, onExplode, removeEnergy, retrieveState, setEnergy, setEnergyMaxCount, setGame, setMaxEnergy, setPoint, setStatus, staysOnColor, stepText, updateEnergy, updateThing
-
-
-
-
Field Detail
-
field
protected Field field
The field the fog is on.
-
-
Method Detail
-
performEnterEffect
protected abstract void performEnterEffect(Thing t, AnimationInfo animation)
Called, if a thing enters (or is placed on) the fog.- Parameters:
t- The entering thing.animation- AnimationInfo
-
performLeaveEffect
protected abstract void performLeaveEffect(Thing t, AnimationInfo animation)
Called, if a thing leaves the fog.- Parameters:
t- The leaving thing.animation- The AnimationÍnfo
-
performStayEffect
protected abstract void performStayEffect(Thing t, AnimationInfo animation)
Called, if a thing stays in the fog.- Parameters:
t- The staying thing.animation- AnimationInfo
-
getFog
public static Fog getFog(java.lang.Class c)
Gets a fog of the given class.- Parameters:
c- The item class- Returns:
- An item for the given class
-
getFog
public static Fog getFog(java.lang.String classname)
Gets a fog of the given class.- Parameters:
classname- The item class- Returns:
- An item for the given class
-
getImageIndex
protected int getImageIndex(AnimationInfo animation)
Gets the fog image index.- Parameters:
animation- The AnimationInfo- Returns:
- The index.
-
getRandomImageIndex
protected int getRandomImageIndex(int max)
Gets a random image index.- Parameters:
max- The max index.- Returns:
- A random index.
-
onEnemyKilled
protected void onEnemyKilled(Figure figure, int roundCount, DieReason reason, AnimationInfo animation)
Called, if something is killed by the fog. Does nothing as default.- Overrides:
onEnemyKilledin classThing- Parameters:
figure- The killed figureroundCount- The round count.reason- The die reason.animation- The AnimationInfo.
-
getImageName
public abstract java.lang.String getImageName(AnimationInfo animation)
Gets an image name for the fog.- Overrides:
getImageNamein classThing- Parameters:
animation- The AnimationInfo.- Returns:
- The image name.
-
toString
public java.lang.String toString()
Returns a String represantation for this point containing this points coordinates- Overrides:
toStringin classjava.lang.Object- Returns:
- A String
-
updateExplodingStatus
protected void updateExplodingStatus(AnimationInfo animation)
Handles the fogs status during update phase of the round when thing is exploding. Sets the status directly to destroyed. Fogs don´t explode in the game (but can be destroyed by calling their die()-method theoretically, though never tried ;-)- Specified by:
updateExplodingStatusin classThing- Parameters:
animation- The AnimationInfo.
-
getName
public java.lang.String getName()
Description copied from class:ThingReturns a display name for the thing.
-
setName
public void setName(java.lang.String name)
-
createState
protected ThingState createState(AnimationInfo animation)
Creates a state object for this item.- Specified by:
createStatein classThing
-
-