Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code suggestion #2

Open
Stader opened this issue Nov 25, 2021 · 2 comments
Open

Code suggestion #2

Stader opened this issue Nov 25, 2021 · 2 comments

Comments

@Stader
Copy link

Stader commented Nov 25, 2021

To increase customization, I'd like to suggest a change to the currentType:

public int currentType
        {
            get => _currentType;

            set
            {
                if (value > maxType) _currentType = 0;
                else if(value < 0)_currentType = maxType;
                else _currentType = value;
            }
        }

So we can go back and forth in the array.

I also incremented a change in InitChange and created its variation to return.

public void InitChangeAdd()
        {
            if (volumes == null) return;
            
            currentType++;
            
            PlayerPrefs.SetInt("Accessibility.ColorblindType", currentType);

            StartCoroutine(ApplyFilter());
            
#if UNITY_EDITOR
            // TODO: Use a public event system to announce the change of the activated filter
            Debug.Log($"Color changed to <b>{(ColorblindTypes)currentType} {currentType}</b>/{maxType}");
#endif
        }

        public void InitChangeRemove()
        {
            if (volumes == null) return;
            
            currentType--;

            PlayerPrefs.SetInt("Accessibility.ColorblindType", currentType);

            StartCoroutine(ApplyFilter());
            
#if UNITY_EDITOR
            // TODO: Use a public event system to announce the change of the activated filter
            Debug.Log($"Color changed to <b>{(ColorblindTypes)currentType} {currentType}</b>/{maxType}");
#endif
        }

There is a way to simplify this in just one method, but for a while I ended up not doing it.

Thank you for developing this solution for color blindness!

@zschzen
Copy link
Collaborator

zschzen commented Dec 20, 2021

I'm really happy with your suggestion, and it's good to know that a project done quickly for a college project caught your eye!

I will now do the steps to implement these fixes and other changes. As I had done in a hurry, a lot of things had to be revised.

For example, I believe that it might be feasible to use a single volume with priority attached and manipulate only it, without having to go through the entire list of the scene looking for any and all volume to manipulate (?!).

@Stader
Copy link
Author

Stader commented Dec 27, 2021

It's a good idea, it would perform better using a single volume. I encourage you to continue this project, at least it is one of the few compatible with the new Unity versions with the URP and HDRP pipelines. You could even put it in the asset store.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants