Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- namespace SpartanFist
- {
- [AddComponentMenu("Interactions/Switches/Logic/Damage Floor")]
- public class DamageFloorLogic : OnAndOffLogic
- {
- /* Damage Floor Stuff */
- public ParticleSystem damageParticles;
- public GameObject damageRegion;
- /* Damage Floor Functions */
- private void FloorEnabled()
- {
- if (damageParticles != null)
- {
- damageParticles.EnableEmission(true);
- }
- if (damageRegion != null)
- {
- damageRegion.SetActive(true);
- }
- }
- private void FloorDisabled()
- {
- if (damageParticles != null)
- {
- damageParticles.EnableEmission(false);
- }
- if (damageRegion != null)
- {
- damageRegion.SetActive(false);
- }
- }
- /* Logic Functions */
- protected override void SwitchInitialState()
- {
- base.SwitchInitialState();
- if (logicSwitch != null)
- {
- if (logicSwitch.SwitchState)
- {
- FloorEnabled();
- }
- else
- {
- FloorDisabled();
- }
- }
- else
- {
- FloorEnabled();
- }
- }
- protected override void SwitchTurnedOn()
- {
- base.SwitchTurnedOn();
- FloorEnabled();
- }
- protected override void SwitchTurnedOff()
- {
- base.SwitchTurnedOff();
- FloorDisabled();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment