コード例 #1
0
    public override void Setup()
    {
        status = PuzzleStatus.INPROGRESS;
        timeRemaining = timeLimit;
        turn = Random.Range(0, 2);
        sequence = new List<char>();
        for (int i = 0; i < totalSequenceLength; i++)
        {
            sequence.Add(LEGAL_LETTERS[Random.Range(0, 6)]);
        }
        inputCorrect = false;
        sequence[0] = 'A';

        // Bubbles
        p1bubble = this.transform.FindChild("P1 Bubble").GetComponent<SpeechBubble>();
        p2bubble = this.transform.FindChild("P2 Bubble").GetComponent<SpeechBubble>();
        p1bubble.Init();
        p2bubble.Init();
        ShowBubble(turn, sequence[0]);
        HideBubble((turn + 1) % 2);

        // Pointer
        pointer = this.transform.FindChild("Pointer").GetComponent<Pointer>();
        pointer.SetFirst(turn);


        // Adjust camera.
        // Save camera positions then move both to our camera point.
        camPosition = this.transform.FindChild("Camera Point").position;
        cam1 = GameObject.Find("P1 Camera").GetComponent<Camera>();
        oldCam1Pos = cam1.transform.position;
        cam1.transform.position = camPosition;
        cam2 = GameObject.Find("P2 Camera").GetComponent<Camera>();
        oldCam2Pos = cam2.transform.position;
        cam2.transform.position = camPosition;
    }