示例#1
0
    bool HandleLever()
    {
        if (Pass)
        {
            return(false);
        }
        Lever.AddInteractionPunch(2.5f);

        bool ans = true;

        for (int a = 0; a < 6; a++)
        {
            if (DialPos[a] != AnswerPos[a])
            {
                ans = false;
                break;
            }
        }

        int[] curPosList = new int[6];
        for (int a = 0; a < 6; a++)
        {
            curPosList[a] = DialPos[a] - ClickPos[a];
            if (curPosList[a] < 0)
            {
                curPosList[a] += 12;
            }
        }
        Debug.Log("[Safety Safe #" + thisLoggingID + "] Input: " + curPosList[0] + "," + curPosList[1] + "," + curPosList[2] + "," + curPosList[3] + "," + curPosList[4] + "," + curPosList[5]);

        if (ans)
        {
            Debug.Log("[Safety Safe #" + thisLoggingID + "] Module solved.");
            Lever.transform.localEulerAngles = new Vector3(0, 210, 0);
            Sound.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform);
            GetComponent <KMBombModule>().HandlePass();
            Pass = true;
        }
        else
        {
            Debug.Log("[Safety Safe #" + thisLoggingID + "] Answer incorrect.");
            GetComponent <KMBombModule>().HandleStrike();
        }
        for (int a = 0; a < 6; a++)
        {
            Dials[a].transform.Find("LED").GetComponent <MeshRenderer>().material.color = (DialPos[a] == AnswerPos[a]) ? new Color(0, 1, 0) : new Color(1, 0, 0);
        }

        return(false);
    }
示例#2
0
 void Update()
 {
     if (TREASURE_ENABLED && doesOpen && Pass)
     {
         if (counter < 5f)
         {
             counter += Time.deltaTime;
             if (counter > 5f)
             {
                 counter = 5f;
             }
             if (!doneUnlock && counter > 0.5f)
             {
                 doneUnlock = true;
                 Lever.AddInteractionPunch(0.1f);
                 Sound.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonRelease, transform);
             }
             if (counter > 1f)
             {
                 Door.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 5f * (counter - 1f)));
             }
         }
     }
 }