Package com.mygdx.game.Entitys
Class College
- java.lang.Object
-
- com.mygdx.game.Entitys.Entity
-
- com.mygdx.game.Entitys.College
-
public class College extends Entity
Defines a college and its associated buildings.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.ArrayList<com.badlogic.gdx.math.Vector2>displacementFromShip(Ship ship)Added for Assessment 2FactiongetFaction()Added for Assessment 2com.badlogic.gdx.math.Vector2getPosition()Added for Assessment 2booleanisAlive()True as long as unharmed buildings remain, false otherwise.voidkillThisCollege(Faction conqueror)Added for Assessment 2 Systematically kills each building attached to this college, then marks the college as dead.voidsetMostRecentAttacker(Faction conqueror)Added for Assessment 2 Sets the Faction which most recently attacked this Collegevoidshoot(com.badlogic.gdx.math.Vector2 startPos, com.badlogic.gdx.math.Vector2 direction)Added for Assessment 2 to meet requirements Calls shoot function of internal componentvoidupdate()Runs once per frame Changed for Assessment 2: - Added checks for if the college is in a specific range of the player - Added functionality where the college shoots at the player if on opposing factions and in range.-
Methods inherited from class com.mygdx.game.Entitys.Entity
addComponent, addComponents, cleanUp, dispose, getComponent, getComponent, getName, raiseEvents, setName
-
-
-
-
Field Detail
-
f
public Faction f
-
-
Constructor Detail
-
College
public College()
Creates a college. Changed for Assessment 2: - Added lastShootTime to store the time when the college last attacked
-
College
public College(int factionId)
Creates a college at the location associated with the given faction id. Changed for Assessment 2: - Set infinite ammo to true in Pirate Component- Parameters:
factionId- numerical id of the faction
-
-
Method Detail
-
isAlive
public boolean isAlive()
True as long as unharmed buildings remain, false otherwise. Changed for Assessment 2: - Added boolean return for Kill Quest functionality. - Renamed boolean for readability - Added functionality for changing Flag upon capture.- Returns:
- the status of this college
-
getFaction
public Faction getFaction()
Added for Assessment 2- Returns:
- The Faction of the Pirate Component attached to this entity
-
setMostRecentAttacker
public void setMostRecentAttacker(Faction conqueror)
Added for Assessment 2 Sets the Faction which most recently attacked this College- Parameters:
conqueror- the Faction which most recently attacked this college
-
getPosition
public com.badlogic.gdx.math.Vector2 getPosition()
Added for Assessment 2- Returns:
- copy of the transform's position
-
displacementFromShip
public java.util.ArrayList<com.badlogic.gdx.math.Vector2> displacementFromShip(Ship ship)
Added for Assessment 2- Parameters:
ship- the Ship being checked- Returns:
- displacement in form [magnitude,direction] between parsed ship and this college
-
shoot
public void shoot(com.badlogic.gdx.math.Vector2 startPos, com.badlogic.gdx.math.Vector2 direction)Added for Assessment 2 to meet requirements Calls shoot function of internal component- Parameters:
startPos- the position the cannonball is to be spawned atdirection- the direction the cannonball is to be fired in
-
killThisCollege
public void killThisCollege(Faction conqueror)
Added for Assessment 2 Systematically kills each building attached to this college, then marks the college as dead.
-
-