com.planeth.gtroids.obj.base
Class AbstractGameObject

java.lang.Object
  extended bycom.planeth.gtroids.obj.base.PaintableObject
      extended bycom.planeth.gtroids.obj.base.AbstractGameObject
All Implemented Interfaces:
ITimeControllable
Direct Known Subclasses:
AbstractPhysicalObject

public abstract class AbstractGameObject
extends PaintableObject
implements ITimeControllable

The abstraction of a base game object

Author:
Andreas Grässer, gal@planet-h.com.
created Jun 12, 2005
See Also:
ObjectStats

Constructor Summary
AbstractGameObject(Shape baseShape)
          Constructor for AbstractGameObject.
 
Method Summary
 void cure()
          Cures the object
Set's the healthPoints to the object's max.
abstract  void die()
          Initates the dead of the Object without any game relevant changes like updating healthPoints and updating players points
protected  AudioResource getAudioResource()
          Returns the audioResource
protected  java.awt.Color getColorBackup()
          Returns the colorBackup
The colorBackup is used to cache the color while changing the base color temporary
 ObjectStats getStats()
          Returns the Stats for the object
protected  TimerManager getTimerManager()
          Returns the timerManager ot the object
 void hitWith(AbstractGameObject gameObject)
          Hits this object with the passed AbstractGameObject
 void hitWithBomb()
          Hits the object with a smart bomb
 void initStats(int healthPoints, int pointsForKill)
          Initializes the ObjectStats
 boolean isEnemy(AbstractGameObject abstractGameObject)
          Returns true, if the passed AbstractGameObject is an enemy of this object
 boolean isReadyToDie()
          Returns true, if the object is ready to get deleted
 void kill()
          Kills the Object including all game relevant actions like updating healthPoints and updating players points.
 void paint(java.awt.Graphics g)
          Paints the object into the passed Graphics
abstract  void pause(boolean pauseState)
          Pauses/unpauses the object or components of the object, which have to be paused.
protected  void setColorBackup(java.awt.Color colorBackup)
          Sets the colorBackup
The colorBackup is used to cache the color while changing the base color temporary
protected  void setColorFixed(boolean colorFixed)
          If set to true, the color doesn't change, if the object is hit or damaged by an another object.
 void setReadyToDie()
          Sets the object ready to get deleted
abstract  void update()
          Does one update step for the Object
 
Methods inherited from class com.planeth.gtroids.obj.base.PaintableObject
addShape, explodeBaseShape, getAvgDiameter, getAvgVector, getBaseColor, getBaseVertexes, getBounds, getMaxRadius, getNrOfVertexes, getOrientation, getPos, move, paintAtPos, randomizeBaseShape, rotate, setBaseColor, splitBaseShape
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGameObject

public AbstractGameObject(Shape baseShape)
Constructor for AbstractGameObject.

Parameters:
baseShape - the baseShape of the object
Method Detail

update

public abstract void update()
Does one update step for the Object


pause

public abstract void pause(boolean pauseState)
Pauses/unpauses the object or components of the object, which have to be paused.

Specified by:
pause in interface ITimeControllable
Parameters:
pauseState -
See Also:
ITimeControllable.pause(boolean)

die

public abstract void die()
Initates the dead of the Object without any game relevant changes like updating healthPoints and updating players points


cure

public void cure()
Cures the object
Set's the healthPoints to the object's max.


hitWith

public void hitWith(AbstractGameObject gameObject)
Hits this object with the passed AbstractGameObject

Parameters:
gameObject - the object, which hits this object

kill

public void kill()
Kills the Object including all game relevant actions like updating healthPoints and updating players points.


hitWithBomb

public void hitWithBomb()
Hits the object with a smart bomb


isEnemy

public boolean isEnemy(AbstractGameObject abstractGameObject)
Returns true, if the passed AbstractGameObject is an enemy of this object

Parameters:
abstractGameObject - the object to check
Returns:
Returns true, if the passed AbstractGameObject is an enemy of this object

initStats

public void initStats(int healthPoints,
                      int pointsForKill)
Initializes the ObjectStats

Parameters:
healthPoints - the base (max) healthPoints for the object
pointsForKill - the points which the player gets for a kill of this object (if its an enemy)

paint

public void paint(java.awt.Graphics g)
Description copied from class: PaintableObject
Paints the object into the passed Graphics

Overrides:
paint in class PaintableObject
Parameters:
g - Graphics to paint into
See Also:
PaintableObject.paint(java.awt.Graphics)

getStats

public ObjectStats getStats()
Returns the Stats for the object

Returns:
Returns the Stats for the object

isReadyToDie

public boolean isReadyToDie()
Returns true, if the object is ready to get deleted

Returns:
Returns true, if the object is ready to get deleted

setReadyToDie

public void setReadyToDie()
Sets the object ready to get deleted


getTimerManager

protected TimerManager getTimerManager()
Returns the timerManager ot the object

Returns:
Returns the timerManager ot the object

getAudioResource

protected AudioResource getAudioResource()
Returns the audioResource

Returns:
Returns the audioResource

setColorFixed

protected void setColorFixed(boolean colorFixed)
If set to true, the color doesn't change, if the object is hit or damaged by an another object.

Parameters:
colorFixed - true = the color is fixed, false = the color depends on current healthPoints.

getColorBackup

protected java.awt.Color getColorBackup()
Returns the colorBackup
The colorBackup is used to cache the color while changing the base color temporary

Returns:
Returns the colorBackup.

setColorBackup

protected void setColorBackup(java.awt.Color colorBackup)
Sets the colorBackup
The colorBackup is used to cache the color while changing the base color temporary

Parameters:
colorBackup - The colorBackup to set.