Package com.mygdx.game.Managers
Class GameManager
- java.lang.Object
-
- com.mygdx.game.Managers.GameManager
-
public final class GameManager extends java.lang.ObjectResponsible for creating most entity's associated with the game. Also, the cached chest and cannonballs
-
-
Constructor Summary
Constructors Constructor Description GameManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidchangeDifficulty(java.lang.String difficulty)Added for assessment 2 loads the part of the json file for the chosen difficulty and overwrites the settings values with these valuesstatic voidCreateCollege(int factionId)Creates the college with it's building for the desired collegestatic NPCShipCreateNPCShip(int factionId)Creates an NPC ship with the given factionstatic voidCreatePlayer()Creates player that belongs the faction with id 1static voidCreateWorldMap(int mapId)Creates the world mapstatic voiddispose()static CollegegetCollege(int factionId)static java.util.ArrayList<College>getColleges()static CannonBallgetCurrentCannon()Added for Assessment 2static FactiongetFaction(int factionId)static NPCShipgetNPCShip(int id)Get an NPCShip in the current gamestatic PlayergetPlayer()Player is always in ships at index 0static com.badlogic.gdx.utils.JsonValuegetSettings()Gets the setting object from the GameSetting.jsonstatic java.util.ArrayList<Ship>getShips()static voidInitialize(GameDifficulty difficulty)facilitates creation of the gamestatic voidshoot(Entity p, com.badlogic.gdx.math.Vector2 pos, com.badlogic.gdx.math.Vector2 dir)Utilises the cached cannonballs to fire one Changed for Assessment 2, separated incrementer for visual clarity and parameterised startPosstatic voidSpawnGame(int mapId)Creates the game with player maps, NPCs, colleges // Change for Assessment 2 Start // Only creates world map if mapId is non-negative For test purposes // Change for Assessment 2 End //static voidupdate()called every frame checks id the quests are completed
-
-
-
Method Detail
-
Initialize
public static void Initialize(GameDifficulty difficulty)
facilitates creation of the game- Parameters:
difficulty- contains the ENUM for the difficulty that has been selected
-
changeDifficulty
public static void changeDifficulty(java.lang.String difficulty)
Added for assessment 2 loads the part of the json file for the chosen difficulty and overwrites the settings values with these values- Parameters:
difficulty- the chosen difficulty as a string
-
update
public static void update()
called every frame checks id the quests are completed
-
getPlayer
public static Player getPlayer()
Player is always in ships at index 0- Returns:
- the ship
-
getNPCShip
public static NPCShip getNPCShip(int id)
Get an NPCShip in the current game- Parameters:
id- the ship's ID- Returns:
- the NPCShip instance
-
SpawnGame
public static void SpawnGame(int mapId)
Creates the game with player maps, NPCs, colleges // Change for Assessment 2 Start // Only creates world map if mapId is non-negative For test purposes // Change for Assessment 2 End //- Parameters:
mapId- the resource id of the tilemap
-
CreatePlayer
public static void CreatePlayer()
Creates player that belongs the faction with id 1
-
CreateNPCShip
public static NPCShip CreateNPCShip(int factionId)
Creates an NPC ship with the given faction- Parameters:
factionId- desired faction- Returns:
- the created ship
-
CreateWorldMap
public static void CreateWorldMap(int mapId)
Creates the world map- Parameters:
mapId- resource id
-
CreateCollege
public static void CreateCollege(int factionId)
Creates the college with it's building for the desired college- Parameters:
factionId- desired faction
-
getFaction
public static Faction getFaction(int factionId)
-
getSettings
public static com.badlogic.gdx.utils.JsonValue getSettings()
Gets the setting object from the GameSetting.json- Returns:
- the JSON representation fo settings
-
getCollege
public static College getCollege(int factionId)
-
getCurrentCannon
public static CannonBall getCurrentCannon()
Added for Assessment 2- Returns:
- Returns the next cannonball that would be fired from the cache
-
shoot
public static void shoot(Entity p, com.badlogic.gdx.math.Vector2 pos, com.badlogic.gdx.math.Vector2 dir)
Utilises the cached cannonballs to fire one Changed for Assessment 2, separated incrementer for visual clarity and parameterised startPos- Parameters:
p- parentpos- position projectile is spawned atdir- shoot direction
-
getShips
public static java.util.ArrayList<Ship> getShips()
-
getColleges
public static java.util.ArrayList<College> getColleges()
-
dispose
public static void dispose()
-
-