bloodloss.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. class BloodLoss extends SymptomBase
  2. {
  3. Material m_MatGauss;
  4. const int BLUR_DURATION = 3000;
  5. float m_BloodSet;
  6. PPERequester_BloodLoss m_RequesterBloodLoss;
  7. //this is just for the Symptom parameters set-up and is called even if the Symptom doesn't execute, don't put any gameplay code in here
  8. override void OnInit()
  9. {
  10. m_SymptomType = SymptomTypes.SECONDARY;
  11. m_Priority = 0;
  12. m_ID = SymptomIDs.SYMPTOM_BLOODLOSS;
  13. m_DestroyOnAnimFinish = true;
  14. m_IsPersistent = false;
  15. m_SyncToClient = true;
  16. m_BloodSet = -1;
  17. if ( !GetGame().IsDedicatedServer() )
  18. {
  19. Class.CastTo(m_RequesterBloodLoss,PPERequester_BloodLoss.Cast(PPERequesterBank.GetRequester(PPERequester_BloodLoss)));
  20. }
  21. }
  22. //!gets called every frame
  23. override void OnUpdateServer(PlayerBase player, float deltatime)
  24. {
  25. }
  26. override void OnUpdateClient(PlayerBase player, float deltatime)
  27. {
  28. if ( player.IsPlayerSelected() && player.GetTransferValues() && player.GetTransferValues().GetBlood() != m_BloodSet )
  29. {
  30. m_BloodSet = player.GetTransferValues().GetBlood();
  31. if (m_BloodSet < 1.0)
  32. {
  33. m_RequesterBloodLoss.SetBloodLossLevel(m_BloodSet);
  34. }
  35. else
  36. {
  37. m_RequesterBloodLoss.Stop();
  38. }
  39. }
  40. }
  41. //!gets called once on an Symptom which is being activated
  42. override void OnGetActivatedServer(PlayerBase player)
  43. {
  44. if (LogManager.IsSymptomLogEnable()) Debug.SymptomLog("n/a", this.ToString(), "n/a", "OnGetActivated", m_Player.ToString());
  45. }
  46. override void OnGetActivatedClient(PlayerBase player)
  47. {
  48. if (LogManager.IsSymptomLogEnable()) Debug.SymptomLog("n/a", this.ToString(), "n/a", "OnGetActivated", m_Player.ToString());
  49. }
  50. override void OnGetDeactivatedServer(PlayerBase player)
  51. {
  52. if (LogManager.IsSymptomLogEnable()) Debug.SymptomLog("n/a", this.ToString(), "n/a", "OnGetDeactivated", m_Player.ToString());
  53. }
  54. //!only gets called once on an active Symptom that is being deactivated
  55. override void OnGetDeactivatedClient(PlayerBase player)
  56. {
  57. if (LogManager.IsSymptomLogEnable()) Debug.SymptomLog("n/a", this.ToString(), "n/a", "OnGetDeactivated", m_Player.ToString());
  58. }
  59. }