Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.0 KiB

  1. #ifndef FUNFACTMGR_H
  2. #define FUNFACTMGR_H
  3. #ifdef _WIN32
  4. #pragma once
  5. #endif
  6. #include "GameEventListener.h"
  7. #include "funfact_cs.h"
  8. #include "utlmap.h"
  9. #include "cs_shareddefs.h"
  10. class FunFactEvaluator;
  11. class CCSFunFactMgr : public CAutoGameSystemPerFrame, public CGameEventListener
  12. {
  13. public:
  14. CCSFunFactMgr();
  15. ~CCSFunFactMgr();
  16. virtual bool Init();
  17. virtual void Shutdown();
  18. virtual void Update( float frametime );
  19. bool GetRoundEndFunFact( int iWinningTeam, e_RoundEndReason iRoundResult, FunFact& funfact );
  20. protected:
  21. float ScoreFunFact( const FunFact& funfact );
  22. void FireGameEvent( IGameEvent *event );
  23. private:
  24. // Weights for all players. Updated every round
  25. // index 0 is for "all players" funfacts, and has the same cooldown behavior as for individual players
  26. float m_playerCooldown[MAX_PLAYERS + 1];
  27. struct FunFactDatabaseEntry
  28. {
  29. const FunFactEvaluator* pEvaluator;
  30. int iOccurrences;
  31. float fCooldown;
  32. };
  33. CUtlMap<int, FunFactDatabaseEntry> m_funFactDatabase;
  34. int m_numRounds;
  35. };
  36. #endif