SepiaToneEffectManager.cs 939 B

1234567891011121314151617181920212223242526272829303132
  1. using UnityEngine;
  2. namespace COM3D2.MeidoPhotoStudio.Plugin
  3. {
  4. public class SepiaToneEffectManger : IEffectManager
  5. {
  6. public const string header = "EFFECT_SEPIA";
  7. private SepiaToneEffect SepiaTone { get; set; }
  8. public bool Ready { get; private set; }
  9. public bool Active { get; private set; }
  10. public void Activate()
  11. {
  12. if (SepiaTone == null)
  13. {
  14. Ready = true;
  15. SepiaTone = GameMain.Instance.MainCamera.GetOrAddComponent<SepiaToneEffect>();
  16. if (SepiaTone.shader == null) SepiaTone.shader = Shader.Find("Hidden/Sepiatone Effect");
  17. }
  18. SetEffectActive(false);
  19. }
  20. public void Deactivate() => SetEffectActive(false);
  21. public void SetEffectActive(bool active) => SepiaTone.enabled = Active = active;
  22. public void Reset() { }
  23. public void Update() { }
  24. }
  25. }