示例#1
0
bool GUIBattle::onBattleStart(BattleEvent& be) {
	if (be.getEventType() == BATTLE_START) {
		auto& camSys = be.getCameraSystem();
		const auto& pokemon = be.getBattler();
		const auto& opponent = be.getOpponent();
		auto& em = be.getEntityManager();

		const auto& pokemonBc = em.getComponent<BattleComponent>(pokemon);
		const auto& opponentBc = em.getComponent<BattleComponent>(opponent);

		//TODO max hp venant des stats du fichier ini
		addHPBar(camSys, pokemonBc.hp, pokemonBc.hp, em, pokemon);
		addHPBar(camSys, opponentBc.hp, opponentBc.hp, em, opponent);
	} else {
		removeHPBar(be.getBattler());
		removeHPBar(be.getOpponent());
	}
	return true;
}
示例#2
0
bool Soilder::init(int soilderID, Vec2 pos, AIManager* ai)
{
    if ( !BaseSprite::init() ) {
        return false;
    }
    
    _soilderID = soilderID;
    _pos = pos;
    _target = nullptr;
    _ai = ai;
    
    loadData();
    showUI();
    addHPBar();
    
    schedule(schedule_selector(Soilder::update), 0.8f);
    
    return true;
}