bullethitstate.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. class BulletHitSymptom extends SymptomBase
  3. {
  4. float m_HitDuration;
  5. float m_BreakPoint;
  6. float m_TimeActive;
  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_BULLET_HIT;
  13. m_DestroyOnAnimFinish = true;
  14. m_SyncToClient = false;
  15. m_HitDuration = 0.4;
  16. m_BreakPoint = 0.1;
  17. }
  18. override void OnUpdateClient(PlayerBase player, float deltatime)
  19. {
  20. m_TimeActive += deltatime;
  21. if(m_TimeActive >= m_HitDuration)
  22. {
  23. RequestDestroy();
  24. }
  25. float value;
  26. if( m_TimeActive <= m_BreakPoint )
  27. {
  28. value = Math.InverseLerp(0, m_BreakPoint, m_TimeActive);
  29. }
  30. else
  31. {
  32. float tmp_value = Math.InverseLerp(m_BreakPoint, m_HitDuration, m_TimeActive);
  33. value = 1 - tmp_value;
  34. }
  35. PPEffects.HitEffect(value);
  36. }
  37. override void OnGetActivatedClient(PlayerBase player)
  38. {
  39. //PPEffects.EnableBurlapSackBlindness();
  40. //PPEffects.HitEffect(1);
  41. }
  42. //!only gets called once on an active Symptom that is being deactivated
  43. override void OnGetDeactivatedClient(PlayerBase player)
  44. {
  45. PPEffects.HitEffect(0);
  46. Debug.Log("OnGetDeactivated CoughSymptom called", "PlayerSymptom");
  47. }
  48. }
  49. */