gameComponents
Class TargetServices

java.lang.Object
  extended by gameComponents.TargetServices

public class TargetServices
extends java.lang.Object

This utility class provides a number of methods that are useful for defining and dealing with targets in the context of a shooter game. The class encapsulates information about N different types of targets. Each target type is identified by a unique index number, starting from 0 and ranging up the the value N-1. For each index, three attributes are defined: the points value of the target, the colour of the target, and the size of the target. These three values together can be used to create a specific kind of target.

Author:
mb

Method Summary
static java.awt.Color getColorForIndex(int index)
          Returns the colour of the target type with the specified index number.
static java.lang.String getColorName(int rgbValue)
          Returns the text label for the given RGB integer value, if one exists.
static int getNumberOfPossibleTargets()
          Returns the total number of targets defined by this utility class.
static java.lang.Integer getPointsForIndex(int index)
          Returns the points value of the target type with the specified index number.
static java.lang.Integer getSizeForIndex(int index)
          Returns the size attribute of the target type with the specified index number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getNumberOfPossibleTargets

public static int getNumberOfPossibleTargets()
Returns the total number of targets defined by this utility class.

Returns:
as described above

getColorName

public static java.lang.String getColorName(int rgbValue)
Returns the text label for the given RGB integer value, if one exists. If a label for the passed RGB value is not defined in the standard palette, then this method returns null.

Returns:
as described above

getColorForIndex

public static java.awt.Color getColorForIndex(int index)
Returns the colour of the target type with the specified index number.

Parameters:
index - must be a value in the range [0,N-1] (where N is the total number of targets defined)
Returns:
as described above

getSizeForIndex

public static java.lang.Integer getSizeForIndex(int index)
Returns the size attribute of the target type with the specified index number.

Parameters:
index - must be a value in the range [0,N-1] (where N is the total number of targets defined)
Returns:
as described above

getPointsForIndex

public static java.lang.Integer getPointsForIndex(int index)
Returns the points value of the target type with the specified index number.

Parameters:
index - must be a value in the range [0,N-1] (where N is the total number of targets defined)
Returns:
as described above