Example #1
0
 void onFakeStrike()
 {
     FakeStatusLight.FlashStrikeFixed(currentStatusLightState);
     if (_isDeact)
     {
         FakeStatusLight.HandleStrike();
         Debug.LogFormat("[Nomai #{0}] Real strike! Module will regenerate.", _moduleId);
         StopCoroutine("timer");
         StopCoroutine(reset(false));
         Destroy(sun);
         _isSolved         = false;
         _isResetting      = false;
         _isSixth          = false;
         _isDeact          = false;
         _willDeact        = false;
         _deactAnnounce    = false;
         timeEvents        = new ArrayList();
         timeEventsTimes   = new ArrayList();
         previous3         = new Action[3];
         colorActionsMain  = new int[7];
         colorActionsLight = new int[7];
         case1             = null;
         barColor          = 0;
         bar.material      = barMats[0];
         Init();
         planetsOrder = new int[] { 0, 1, 2, 3, 4, 5 };
         reRender();
         StartCoroutine("timer");
         return;
     }
     _isResetting = true;
     StopCoroutine("timer");
     StartCoroutine(reset(timeRatio * 80f));
     Debug.LogFormat("[Nomai #{0}] Fake strike! Module is not interactable until next loop.", _moduleId);
 }
Example #2
0
 void Strike()
 {
     Debug.LogFormat("[Red Herring #{0}] You pressed too early. Strike, pin head.", moduleId);
     FakeStatusLight.HandleStrike();
     TogglePress       = false;
     DistractionPicker = UnityEngine.Random.Range(0, Distractions.Count());
     TogglePress       = false;
     StopAllCoroutines();
 }
Example #3
0
 void Strike()
 {
     Debug.LogFormat("[Red Herring #{0}] You presssed when the button was {1}. You pressed too {2}. Strike.",
                     moduleId, buttonObject.GetComponent <MeshRenderer>().material.name.TakeWhile(x => !Char.IsWhiteSpace(x)).Join(""),
                     Array.IndexOf(colorIndices, correctColor) > stageNumber ? "early" : "late");
     FakeStatusLight.HandleStrike();
     stageNumber = 0;
     buttonObject.GetComponent <MeshRenderer>().material = startColor;
     cbText.text = string.Empty;
     GetColorOrder();
     TogglePress       = false;
     DistractionPicker = UnityEngine.Random.Range(0, Distractions.Count());
     TogglePress       = false;
     StopAllCoroutines();
 }
    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;
    }
Example #5
0
 private void HandleSubmit()
 {
     if (_grid[_curPos] == 0)
     {
         Debug.LogFormat("[Cursed Double-Oh #{0}] Pressed Submit on 00. Module solved.", _moduleId);
         _isSolved = true;
         FakeStatusLight.HandlePass();
         Audio.PlaySoundAtTransform("DoubleOSolve", transform);
     }
     else if (_grid[_curPos] < 10)
     {
         Debug.LogFormat("[Cursed Double-Oh #{3}] Pressed Submit on number {0:00} (grid location {1},{2}).  Strike!  Now resetting...", _grid[_curPos], _curPos % 9 + 1, _curPos / 9 + 1, _moduleId);
         FakeStatusLight.HandleStrike();
         ResetSituation();
     }
     else
     {
         Debug.LogFormat("[Cursed Double-Oh #{3}] Pressed Submit on number {0:00} (grid location {1},{2}).  Now resetting...", _grid[_curPos], _curPos % 9 + 1, _curPos / 9 + 1, _moduleId);
         Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.Strike, Module.transform);
         FakeStatusLight.FlashStrike();
         ResetSituation();
     }
 }
 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;
         }
     }
 }