public TimeComponent(GameEntity owner, GameSystem gameSystem, Object[] arguments) { super(owner, gameSystem); owner.addComponent(this); gameSystem.registerComponent(this); init(arguments); }
/** Create a monster randomly picked from all enemy types. */ public static GameEntity createRandomEnemy( GameSystem gameSystem, AreaComponent areaComponent, int level) { // Select a random key and value set from the enemy info Map Random random = new Random(); List<String> keys = new ArrayList<String>(enemyInfoMap.keySet()); String randomKey = keys.get(random.nextInt(keys.size())); Stats pick = enemyInfoMap.get(randomKey); // Use it to create the monster by passing the name GameEntity entity = createEnemy(gameSystem, pick.getName(), areaComponent, level); // Assign a random stats modifier StatsModifier randomStatsModifier = getRandomStatsModifier(); gameSystem.getCharacterComponent(entity.getID()).setStatsModifier(randomStatsModifier); return entity; }