示例#1
0
    IEnumerator DoubleOhStrikeTime()
    {
        yield return(new WaitForSeconds(4f));

        Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.Strike, Chungun.transform);
        FakeStatusLight.FlashStrike();
        if (TwitchPlaysActive)
        {
            tpAPI["ircConnectionSendMessage"] = "VoteNay Module " + GetModuleCode() + " (Red Herring) got a strike! -6 points from MrPeanut1028 VoteNay!";
        }
    }
示例#2
0
    IEnumerator DoubleOhStrikeTime()
    {
        yield return(new WaitForSeconds(2.5f));

        Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, buttonSelectable.transform);
        buttonSelectable.AddInteractionPunch();
        Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.Strike, transform);
        FakeStatusLight.FlashStrike();
        if (TwitchPlaysActive)
        {
            tpAPI["ircConnectionSendMessage"] = string.Format("VoteNay Module {0} (Red Herring) got a strike! -6 points from Marksam32 VoteNay!", GetModuleCode());
        }
    }
    private IEnumerator GiveStrike(Transform wall, Transform from, Transform to)
    {
        BombModule.LogFormat("Tried to move from {0} to {1} - {2}, but there was a wall in the way. Strike", GetCoordinates(from),
                             GetCoordinates(to), GetDirection(from, to));


        var hitWall  = 8;
        var moveFrom = new Vector3(from.parent.transform.localPosition.x, StatusLight.localPosition.y, from.localPosition.z);
        var moveto   = new Vector3(to.parent.transform.localPosition.x, StatusLight.localPosition.y, to.localPosition.z);
        var movement = (moveto - moveFrom) / 4 / hitWall;

        for (var i = 0; i < hitWall; i++)
        {
            StatusLight.localPosition += movement;
            yield return(null);
        }
        StartCoroutine(ShowWall(wall.gameObject.GetComponent <MeshRenderer>()));
        if (!_unicorn)
        {
            FakeStatusLight.HandleStrike();
        }
        else
        {
            FakeStatusLight.FlashStrike();
            TwitchPlays.CauseFakeStrike(BombModule);
            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.Strike, transform);
        }
        Audio.HandlePlaySoundAtTransform(GlassBreak.name, transform);
        for (var i = 0; i < hitWall; i++)
        {
            StatusLight.localPosition -= movement;
            yield return(null);
        }

        yield return(new WaitForSeconds(0.5f));

        _strikePending = false;
    }
 public void Submit()
 {
     if (IsSolved)
     {
         return;
     }
     DebugMsg(NoteNames[Answer] + " was submitted");
     if (Answer == NoteIndex)         //If Correct
     {
         DebugMsg("Answer correct");
         CurrentStage++;
         for (int i = 0; i < RedNotes.Length; i++)
         {
             RedNotes[i] = false;
         }
         if (CurrentStage >= 3)
         {
             Light.HandlePass();
             DebugMsg("Three stages have been passed. Module solved.");
         }
         else
         {
             CurrentNote = GenerateNote();
         }
     }
     else         //If Incorrect
     {
         NumStrikes++;
         if (NumStrikes < StrikeText.Length + 1)
         {
             Light.FlashStrike();
             PPKMAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.Strike, PPModule.GetComponent <Transform>());
             RedNotes[Answer] = true;
             MainText.color   = Red;
             DebugMsg("Answer incorrect. Fake strike recorded.");
         }
         else
         {
             Light.HandleStrike();
             RefAvailable    = true;
             RefInd.material = RAMat;
             CurrentNote     = GenerateNote();
             CurrentStage    = 0;
             NumStrikes      = 0;
             for (int i = 0; i < RedNotes.Length; i++)
             {
                 RedNotes[i] = false;
             }
             MainText.color = On;
             DebugMsg("Answer incorrect. Real strike recorded.");
         }
         for (int i = 0; i < StrikeText.Length; i++)
         {
             TextMesh t = StrikeText[i];
             if (NumStrikes > i)
             {
                 t.color = On;
             }
             else
             {
                 t.color = Off;
             }
         }
     }
     //Regardless
     for (int i = 0; i < StageInd.Length; i++)
     {
         if (i < CurrentStage)
         {
             StageInd[i].material = StageOn;
         }
         else
         {
             StageInd[i].material = StageOff;
         }
     }
 }
示例#5
0
    private KMSelectable.OnInteractHandler GetButtonHandler(int i)
    {
        return(delegate
        {
            if (lastButtonPressed == i)
            {
                return false;
            }
            Buttons[i].AddInteractionPunch();
            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, Buttons[i].transform);
            if (_isSolved)
            {
                return false;
            }

            if (_sounds[i] != null)
            {
                Audio.PlaySoundAtTransform(_sounds[i], Buttons[i].transform);
            }

            var x = _curPos % 9;
            var y = _curPos / 9;

            switch (_functions[i])
            {
            case ButtonFunction.SmallLeft:
                x = (x / 3) * 3 + (x % 3 + 2) % 3;
                break;

            case ButtonFunction.SmallRight:
                x = (x / 3) * 3 + (x % 3 + 1) % 3;
                break;

            case ButtonFunction.SmallUp:
                y = (y / 3) * 3 + (y % 3 + 2) % 3;
                break;

            case ButtonFunction.SmallDown:
                y = (y / 3) * 3 + (y % 3 + 1) % 3;
                break;

            case ButtonFunction.LargeLeft:
                x = (x + 6) % 9;
                break;

            case ButtonFunction.LargeRight:
                x = (x + 3) % 9;
                break;

            case ButtonFunction.LargeUp:
                y = (y + 6) % 9;
                break;

            case ButtonFunction.LargeDown:
                y = (y + 3) % 9;
                break;

            default:        // submit button
                HandleSubmit();
                return false;
            }
            var _tempPos = y * 9 + x;
            if (visitedNumbers.Contains(_grid[_tempPos]))
            {
                Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.Strike, Module.transform);
                FakeStatusLight.FlashStrike();
                Debug.LogFormat("[Cursed Double-Oh #{4}] Pressed {1} but already hit {0:00} (grid location {2},{3}).", _grid[_tempPos], _functions[i], _tempPos % 9 + 1, _tempPos / 9 + 1, _moduleId);
            }
            else
            {
                _curPos = y * 9 + x;
                visitedNumbers.Add(_grid[_tempPos]);
                lastButtonPressed = i;
                Debug.LogFormat("[Cursed Double-Oh #{4}] Pressed {1}. Number is now {0:00} (grid location {2},{3}).", _grid[_curPos], _functions[i], _curPos % 9 + 1, _curPos / 9 + 1, _moduleId);
                return false;
            }
            return false;
        });
    }