|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrobocode.naval.ComponentBase
robocode.naval.WeaponComponent
public class WeaponComponent
A class that resembles a weapon component for on a ship.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class robocode.naval.ComponentBase |
---|
ComponentBase.HiddenComponentHelper |
Field Summary | |
---|---|
static double |
BLIND_SPOT_ANGLE
The half and full blind arc angle for any weapon. |
static double |
HALF_BLIND_SPOT_ANGLE
The half and full blind arc angle for any weapon. |
Fields inherited from class robocode.naval.ComponentBase |
---|
angle, lastHeading, type |
Constructor Summary | |
---|---|
WeaponComponent(double x,
double y,
ComponentType type)
Creates a new weapon component for the ship. |
|
WeaponComponent(double x,
double y,
ComponentType type,
double start,
double extent)
Creates a new weapon component for the ship. |
|
WeaponComponent(Point2D pivot,
ComponentType type,
double start,
double extent)
Creates a new weapon component for the ship. |
Method Summary | |
---|---|
void |
coolDown(double coolingRate)
Cool down the weapon. |
void |
fire(ITransformable peer)
Deprecated. |
boolean |
getAtBlindSpot()
|
Color |
getBulletColor()
|
BlindSpot |
getCopyOfBlindSpot()
|
double |
getFireAngle(ITransformable peer)
Get the angle towards which the bullet gets fired. |
double |
getFirePower()
Get the fire power of the weapon. |
double |
getGunHeat()
Get the gun heat. |
byte |
getSerializeType()
|
double |
getTypeOffset()
Get the angular offset in radians based upon the weapon type. |
void |
setAngle(double turnRemaining)
Set the angle of the component; in radians. |
void |
setAngleDegrees(double angle)
Set the angle of the component; in degrees. |
void |
setBulletColor(Color color)
|
void |
setFirePower(double energy,
double power)
Set the fire power of the weapon. |
double |
turnRadians(double turnRemaining)
Attempts to turn the component. |
void |
updateGunHeat(double gunHeat)
|
Methods inherited from class robocode.naval.ComponentBase |
---|
equals, getAngle, getAngleDegrees, getColor, getLastAngle, getOrigin, getPivot, getType, setColor, setLastAngle, setType, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final double BLIND_SPOT_ANGLE
public static final double HALF_BLIND_SPOT_ANGLE
Constructor Detail |
---|
public WeaponComponent(double x, double y, ComponentType type)
arcSize
is zero there will be no blind arc.
x
- The X-coordinate of the pivot point of the component.y
- The Y-coordinate of the pivot point of the component.type
- The type of weapon component.public WeaponComponent(double x, double y, ComponentType type, double start, double extent)
arcSize
is zero there will be no blind arc.
x
- The X-coordinate of the pivot point of the component.y
- The Y-coordinate of the pivot point of the component.type
- The type of weapon component.start
- The starting angle (in degrees) of the blind arc.extent
- The size of the blind arc as an angle(in degrees) that
the weapon can not cover. (Negative means to the left
of the starting angle/positive means to the right.)public WeaponComponent(Point2D pivot, ComponentType type, double start, double extent)
arcSize
is zero there will be no blind arc.
pivot
- The pivot point of the component.type
- The type of weapon component.start
- The starting angle (in degrees) of the blind arc.extent
- The size of the blind arc as an angle(in degrees) that
the weapon can not cover. (Negative means to the left
of the starting angle/positive means to the right.)Method Detail |
---|
public void setFirePower(double energy, double power)
energy
- The energy the robot has left.power
- The fire power of the weapon.public double getFirePower()
public void updateGunHeat(double gunHeat)
@Deprecated public void fire(ITransformable peer)
peer
- The owner of the weapon.public double getGunHeat()
getGunHeat
in interface IComponent
getGunHeat
in class ComponentBase
public void coolDown(double coolingRate)
coolingRate
- The rate at which to cool down the weapon.public double getFireAngle(ITransformable peer)
peer
- The ship that fired the bullet.
public BlindSpot getCopyOfBlindSpot()
public void setBulletColor(Color color)
public Color getBulletColor()
public double getTypeOffset()
public void setAngle(double turnRemaining)
setAngle
in interface IComponent
setAngle
in class ComponentBase
turnRemaining
- The angle to which to set the component.public void setAngleDegrees(double angle)
setAngleDegrees
in interface IComponent
setAngleDegrees
in class ComponentBase
angle
- The angle to which to set the component.public boolean getAtBlindSpot()
public double turnRadians(double turnRemaining)
IComponent
turnRadians
in interface IComponent
turnRadians
in class ComponentBase
turnRemaining
- The angle in RADIANS the component still has to turn.
public byte getSerializeType()
getSerializeType
in interface IComponent
getSerializeType
in class ComponentBase
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |