Exemplo n.º 1
0
    private IEnumerator PlayWordLocation(string word)
    {
        while (!_solved)
        {
            var playword = FakeStatusLight.PlayWord(word);
            do
            {
                yield return(playword.Current);

                if (_solved)
                {
                    yield break;
                }
            } while (playword.MoveNext());
            yield return(new WaitForSeconds(3f));

            if (_solved)
            {
                yield break;
            }
            playword = FakeStatusLight.PlayWord(_destination.parent.name + _destination.name);
            do
            {
                yield return(playword.Current);

                if (_solved)
                {
                    yield break;
                }
            } while (playword.MoveNext());
            yield return(new WaitForSeconds(3f));
        }
    }
    public void EnableColorblindMode(bool enable)
    {
        if (!_colorblindCalled)
        {
            _colorblindCalled                  = true;
            FakeStatusLight.PassColor          = _modSettings.Settings.SolvedState;
            FakeStatusLight.FailColor          = _modSettings.Settings.StrikeState;
            FakeStatusLight.OffColor           = _modSettings.Settings.OffState;
            FakeStatusLight.MorseTransmitColor = _modSettings.Settings.MorseXmitState;
        }


        if (_colorblindEnabled || !enable)
        {
            return;
        }
        _colorblindEnabled = true;

        var defaultColors = new ModuleSettings();

        if (FakeStatusLight.PassColor == defaultColors.SolvedState &&
            FakeStatusLight.FailColor == defaultColors.StrikeState &&
            FakeStatusLight.OffColor == defaultColors.OffState &&
            FakeStatusLight.MorseTransmitColor == defaultColors.MorseXmitState)
        {
            FakeStatusLight.OffColor           = Random.value < 0.5f ? StatusLightState.Red : StatusLightState.Green;
            FakeStatusLight.MorseTransmitColor = StatusLightState.Off;
        }
        else
        {
            FakeStatusLight.PlayWord(null).MoveNext();
            if ((FakeStatusLight.OffColor == StatusLightState.Green &&
                 FakeStatusLight.MorseTransmitColor == StatusLightState.Red) ||
                (FakeStatusLight.OffColor == StatusLightState.Red &&
                 FakeStatusLight.MorseTransmitColor == StatusLightState.Green))
            {
                if (Random.value < 0.5f)
                {
                    FakeStatusLight.MorseTransmitColor = StatusLightState.Off;
                }
                else
                {
                    FakeStatusLight.OffColor = StatusLightState.Off;
                }
            }
        }
    }