robocode.naval
Class RadarComponent

java.lang.Object
  extended by robocode.naval.ComponentBase
      extended by robocode.naval.RadarComponent
All Implemented Interfaces:
Serializable, IComponent

public class RadarComponent
extends ComponentBase

A class that resembles a radar component for on a ship.

Since:
1.8.3.0 Alpha 1
Version:
0.1
Author:
Thales B.V. / Jiri Waning
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class robocode.naval.ComponentBase
ComponentBase.HiddenComponentHelper
 
Field Summary
 
Fields inherited from class robocode.naval.ComponentBase
angle, lastHeading, type
 
Constructor Summary
RadarComponent(double x, double y)
          Creates a new radar component for on the robot.
RadarComponent(double x, double y, ComponentType type)
          Creates a new radar component for on the robot.
RadarComponent(Point2D pivot, ComponentType type)
          Creates a new radar component for on the robot.
 
Method Summary
 Arc2D.Double getScanArc()
           
 Color getScanColor()
           
 byte getSerializeType()
           
 boolean insideScanArc(ITransformable peer)
          Determines whether or not the peer is inside the scan arc.
 boolean insideScanArc(Point2D projectile)
          Determines whether or not the projectile is inside the scan arc.
 void setScanColor(Color color)
           
 double turnRadians(double turnRemaining)
          Attempts to turn the component.
 void updateScanArc(ITransformable shipPeer)
          Update the scan arc of the radar.
 
Methods inherited from class robocode.naval.ComponentBase
equals, getAngle, getAngleDegrees, getColor, getGunHeat, getLastAngle, getOrigin, getPivot, getType, setAngle, setAngleDegrees, setColor, setLastAngle, setType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RadarComponent

public RadarComponent(double x,
                      double y)
Creates a new radar component for on the robot.

Parameters:
x - The X-coordinate of the pivot point of the component.
y - The Y-coordinate of the pivot point of the component.

RadarComponent

public RadarComponent(double x,
                      double y,
                      ComponentType type)
Creates a new radar component for on the robot.

Parameters:
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 radar component.

RadarComponent

public RadarComponent(Point2D pivot,
                      ComponentType type)
Creates a new radar component for on the robot.

Parameters:
pivot - The pivot point of the component.
type - The type of radar component.
Method Detail

turnRadians

public double turnRadians(double turnRemaining)
Attempts to turn the component.

Specified by:
turnRadians in interface IComponent
Specified by:
turnRadians in class ComponentBase
Parameters:
turnRemaining - The angle in RADIANS the component still has to turn.
Returns:
The turnRemaining after the turning has been done.

getScanColor

public Color getScanColor()

setScanColor

public void setScanColor(Color color)

getScanArc

public Arc2D.Double getScanArc()

updateScanArc

public void updateScanArc(ITransformable shipPeer)
Update the scan arc of the radar.

Parameters:
shipPeer - The peer to whom the radar belongs.

insideScanArc

public boolean insideScanArc(ITransformable peer)
Determines whether or not the peer is inside the scan arc.

Parameters:
peer - The peer to determine from if it is inside the scan arc.
Returns:
true when the peer is in the scan arc; false otherwise.

insideScanArc

public boolean insideScanArc(Point2D projectile)
Determines whether or not the projectile is inside the scan arc.

Parameters:
projectile - The projectile that has to be inside the scan arc,
Returns:
true when the projectile is in the scan arc; false otherwise.

getSerializeType

public byte getSerializeType()
Specified by:
getSerializeType in interface IComponent
Overrides:
getSerializeType in class ComponentBase


Copyright © 2015 Robocode. All Rights Reserved.