Class UpgradeNode
java.lang.Object
com.csse3200.game.components.upgradetree.UpgradeNode
Represents a node within the upgrade tree.
Each node holds information about a particular weapon upgrade, its image, and its children in the tree.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addChild
(UpgradeNode child) Adds a child node to this node.Returns a list of child nodes.Gets the config file associated with the toolint
getDepth()
Returns the current node's depthReturns the image path associated with this node.getName()
Gets the name of the tool/weaponint
Gets the selected nodes upgrade costReturns the current node's parent nodeReturns the type of weapon this node represents.float
getX()
Returns the x-coordinate of the node.float
getY()
Returns the y-coordinate of the node.void
setDepth
(int depth) Sets the current node's depthvoid
setParent
(UpgradeNode parent) Sets the parent of the current nodevoid
setX
(float x) Sets the x-coordinate of the node.void
setY
(float y) Sets the y-coordinate of the node.
-
Method Details
-
setParent
Sets the parent of the current node -
getParent
Returns the current node's parent node -
getConfig
Gets the config file associated with the tool -
getName
Gets the name of the tool/weapon -
setDepth
public void setDepth(int depth) Sets the current node's depth -
getDepth
public int getDepth()Returns the current node's depth -
addChild
Adds a child node to this node.- Parameters:
child
- The child node to be added.
-
setX
public void setX(float x) Sets the x-coordinate of the node.- Parameters:
x
- The x-coordinate.
-
setY
public void setY(float y) Sets the y-coordinate of the node.- Parameters:
y
- The y-coordinate.
-
getX
public float getX()Returns the x-coordinate of the node.- Returns:
- The x-coordinate.
-
getY
public float getY()Returns the y-coordinate of the node.- Returns:
- The y-coordinate.
-
getWeaponType
Returns the type of weapon this node represents.- Returns:
- The weapon type.
-
getChildren
Returns a list of child nodes.- Returns:
- The child nodes.
-
getImagePath
Returns the image path associated with this node.- Returns:
- The image path.
-
getNodeCost
public int getNodeCost()Gets the selected nodes upgrade cost- Returns:
- int: the nodes cost
-