Class College


  • public class College
    extends Entity
    Defines a college and its associated buildings.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      Faction f  
    • Constructor Summary

      Constructors 
      Constructor Description
      College()
      Creates a college.
      College​(int factionId)
      Creates a college at the location associated with the given faction id.
    • 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 2
      Faction getFaction()
      Added for Assessment 2
      com.badlogic.gdx.math.Vector2 getPosition()
      Added for Assessment 2
      boolean isAlive()
      True as long as unharmed buildings remain, false otherwise.
      void killThisCollege​(Faction conqueror)
      Added for Assessment 2 Systematically kills each building attached to this college, then marks the college as dead.
      void setMostRecentAttacker​(Faction conqueror)
      Added for Assessment 2 Sets the Faction which most recently attacked this College
      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
      void update()
      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 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 at
        direction - 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.
      • update

        public void update()
        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.
        Overrides:
        update in class Entity