Guest User

Untitled

a guest
May 30th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. namespace SpartanFist
  5. {
  6. [AddComponentMenu("Interactions/Switches/Logic/Damage Floor")]
  7. public class DamageFloorLogic : OnAndOffLogic
  8. {
  9. /* Damage Floor Stuff */
  10.  
  11. public ParticleSystem damageParticles;
  12. public GameObject damageRegion;
  13.  
  14. /* Damage Floor Functions */
  15.  
  16. private void FloorEnabled()
  17. {
  18. if (damageParticles != null)
  19. {
  20. damageParticles.EnableEmission(true);
  21. }
  22.  
  23. if (damageRegion != null)
  24. {
  25. damageRegion.SetActive(true);
  26. }
  27. }
  28.  
  29. private void FloorDisabled()
  30. {
  31. if (damageParticles != null)
  32. {
  33. damageParticles.EnableEmission(false);
  34. }
  35.  
  36. if (damageRegion != null)
  37. {
  38. damageRegion.SetActive(false);
  39. }
  40. }
  41.  
  42. /* Logic Functions */
  43.  
  44. protected override void SwitchInitialState()
  45. {
  46. base.SwitchInitialState();
  47.  
  48. if (logicSwitch != null)
  49. {
  50. if (logicSwitch.SwitchState)
  51. {
  52. FloorEnabled();
  53. }
  54. else
  55. {
  56. FloorDisabled();
  57. }
  58. }
  59. else
  60. {
  61. FloorEnabled();
  62. }
  63. }
  64.  
  65. protected override void SwitchTurnedOn()
  66. {
  67. base.SwitchTurnedOn();
  68.  
  69. FloorEnabled();
  70. }
  71.  
  72. protected override void SwitchTurnedOff()
  73. {
  74. base.SwitchTurnedOff();
  75.  
  76. FloorDisabled();
  77. }
  78. }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment