Пример #1
0
    public void init()
    {
        seenPlayers = new List <int>();
        //qrEncoder.initialize ();
        qrEncoder.onQREncodeFinished += qrEncodeReady;
        startGameButton.interactable  = false;
        gameController.quickSaveData.localUserLogin = "******";
        gameController.localUserLogin = "******";
        state = 1;
        fader.fadeIn();
        gameController.isMaster = true;
        updateNoticeScaler.scaleOutImmediately();
        string sss = (string)messagesTable.getElement(0, Utils.MsgIncompatVersion);

        updateNoticeText.text = (string)messagesTable.getElement(0, Utils.MsgIncompatVersion);
    }
    public void spawn(int type)
    {
        GameObject newGO = (GameObject)Instantiate(dropletPrefab);

        newGO.GetComponent <SentenceDroplet> ().YAccel          = YAccel;
        newGO.GetComponent <SentenceDroplet> ().ZAccel          = YAccel;
        newGO.GetComponent <SentenceDroplet> ().ZSpeed          = initialZSpeed;
        newGO.GetComponent <SentenceDroplet> ().killDeltaZAccel = killZSpeed;

        if (type == 0)
        {
            int    r     = Random.Range(0, frasesQueNosUnen.nRows());
            string frase = (string)frasesQueNosUnen.getElement(0, r);
            frase = StringUtils.chopLines(frase, 10);
            newGO.transform.position = spawnUnen.transform.position;
            newGO.GetComponent <SentenceDroplet> ().setText(frase);
            newGO.GetComponent <SentenceDroplet> ().Start();
            timeToSpawnUnen = Random.Range(minTimeToSpawn, maxTimeToSpawn);
        }

        if (type == 1)
        {
            int    r     = Random.Range(0, frasesQueNosSeparan.nRows());
            string frase = (string)frasesQueNosSeparan.getElement(0, r);
            frase = StringUtils.chopLines(frase, 10);
            newGO.transform.position = spawnSeparan.transform.position;
            newGO.GetComponent <SentenceDroplet> ().setText(frase);
            newGO.GetComponent <SentenceDroplet> ().Start();
            timeToSpawnSeparan = Random.Range(minTimeToSpawn, maxTimeToSpawn);
        }
    }
    public void startEmocionario()
    {
        Start();
        descriptionFader.Start();
        okButton.scaleIn();
        for (int i = 0; i < cloudText.Length; ++i)
        {
            cloudText [i].text = (string)table.getElement(0, i);
        }

        //w.isWaitingForTaskToComplete = true;
        //waiter = w;
        emocionarioCanvas.SetActive(true);
        descriptionText.text = "";
        fader.fadeIn();
        scroller.initialize();
        state = 0;
    }
    // Update is called once per frame
    void Update()
    {
        if (state == 0)
        {
            // idle
        }

        if (state == 1)
        {
            player.blockControls();
            int row;
            // choose a sentence
            if ((nFrasesMente > 0) && (nFrasesCiencia > 0))
            {
                int r = Random.Range(0, 2);
                if (r == 0)
                {
                    currentIsScience = true;
                    row          = cienciaTabla.getNextRowIndex();
                    currentFrase = (string)cienciaTabla.getElement("FRASE", row);
                    --nFrasesCiencia;
                }
                else
                {
                    currentIsScience = false;
                    row          = espirituTabla.getNextRowIndex();
                    currentFrase = (string)espirituTabla.getElement("FRASE", row);
                    --nFrasesMente;
                }
            }
            else
            {
                if ((nFrasesCiencia > 0))
                {
                    currentIsScience = true;
                    row          = cienciaTabla.getNextRowIndex();
                    currentFrase = (string)cienciaTabla.getElement("FRASE", row);
                    --nFrasesCiencia;
                }
                else if ((nFrasesMente > 0))
                {
                    currentIsScience = false;
                    row          = espirituTabla.getNextRowIndex();
                    currentFrase = (string)espirituTabla.getElement("FRASE", row);
                    --nFrasesMente;
                }
                else
                {
                    puente._wm_resetBridge();

                    reset();
                }
            }
            state = 2;
            alert._wa_setAlertMessage(this, currentFrase);
            alert.registerWaitingObject(this, 0);
            this.programIsWaitingForActionToComplete [0] = true;
        }

        if (state == 2)
        {
            if (!this.programIsWaitingForActionToComplete [0])
            {
                player.unblockControls();
                state = 3;
            }
        }

        if (state == 3)           // waiting for player input... state will change to 4

        {
        }

        if (state == 4)
        {
            if (playerVotesScience == currentIsScience)               // correct
            {
                if (currentIsScience)
                {
                    cienciaPart.Play();
                    cienciaSignal._wm_signal();
                    Invoke("stopAllParticles", 3.75f);

                    puente._wm_lowerBridge();
                }
                else
                {
                    espirituPart.Play();
                    espirituSignal._wm_signal();
                    Invoke("stopAllParticles", 3.75f);

                    puente._wm_lowerBridge();
                }
            }
            else                 // incorrect
            {
                puente._wm_resetBridge();

                reset();
            }
            if ((nFrasesMente == 0) && (nFrasesCiencia == 0))               // fin del test
            {
                state = 0;
                cameraFollow.clearIntermediateLocations();                  // libera la cámara
                GameObject.Find("LevelController").GetComponent <LevelControllerScript>().storeBoolValue("N4TestPuentePassed", true);
                bloqueoFrontal.SetActive(false);
                bloqueoTrasero1.SetActive(false);
                bloqueoTrasero2.SetActive(false);
                player.unblockControls();
            }
            else
            {
                player._wa_autopilotTo(this, -56.96f, 59.25f, -223.0f);
                this.isWaitingForActionToComplete = true;
                state = 5;
            }
        }

        if (state == 5)
        {
            if (!this.isWaitingForActionToComplete)
            {
                player._wa_autopilotTo(this, -56.96f, 59.25f, -222.55f);
                this.isWaitingForActionToComplete = true;
                state = 6;
            }
        }

        if (state == 6)
        {
            if (!this.isWaitingForActionToComplete)
            {
                player.idlePose();
                state = 1;
            }
        }
    }
Пример #5
0
    protected void updateInterrogationText(bool negative, int subType)
    {
        if (!negative)           // Positive situation
        {
            if (tType == 0)
            {
                helpPanelText.text = (string)tablaAyuda.getElement(0, 7);
            }
            if (tType == 1)
            {
                helpPanelText.text = (string)tablaAyuda.getElement(0, 7);
            }
            if (tType == 2)
            {
                helpPanelText.text = (string)tablaAyuda.getElement(0, 7);
            }
            if (tType == 3)
            {
                if (subType == 0)
                {
                    helpPanelText.text = (string)tablaAyuda.getElement(0, 7);
                }
                if (subType == 1)
                {
                    helpPanelText.text = (string)tablaAyuda.getElement(0, 7);
                }
                if (subType == 2)
                {
                    helpPanelText.text = (string)tablaAyuda.getElement(0, 7);
                }
            }
            if (tType == 4)
            {
                helpPanelText.text = (string)tablaAyuda.getElement(0, 7);
            }
            helpPanelText.text = helpPanelText.text.Replace("\\n", "\n").Replace("#", ":");
        }

        else           // negative situacion
        {
            if (tType == 0)
            {
                helpPanelText.text = (string)tablaAyuda.getElement(0, 0);
            }
            if (tType == 1)
            {
                helpPanelText.text = (string)tablaAyuda.getElement(0, 1);
            }
            if (tType == 2)
            {
                helpPanelText.text = (string)tablaAyuda.getElement(0, 2);
            }
            if (tType == 3)
            {
                if (subType == 0)
                {
                    helpPanelText.text = (string)tablaAyuda.getElement(0, 4);
                }
                if (subType == 1)
                {
                    helpPanelText.text = (string)tablaAyuda.getElement(0, 3);
                }
                if (subType == 2)
                {
                    helpPanelText.text = (string)tablaAyuda.getElement(0, 5);
                }
            }
            if (tType == 4)
            {
                helpPanelText.text = (string)tablaAyuda.getElement(0, 6);
            }
            helpPanelText.text = helpPanelText.text.Replace("\\n", "\n").Replace("#", ":");;
        }
    }
Пример #6
0
    public void calculateScores()
    {
        int tS = 0;



        for (int i = 0; i < GameController_mono.MaxPlayers; ++i)
        {
            if (!gameController.playerPresent [i])
            {
                for (int j = 0; j < TicketScreenController_mono.MaxColors; ++j)
                {
                    gameController.playerList [i].bottlesGiven [j] = -1;
                }
            }
        }



//		int totalBottles = 0;
//		for(int i = 0; i < TicketScreenController.MaxColors-1; ++i) {
//			int nOfBottles = gameController.playerList [gameController.localPlayerN].bottlesReceived [i];
//			colorBottlesText [i].text = "x " + nOfBottles;
//			totalBottles += nOfBottles;
//		}
//
//		totalBottlesText.text = "" + totalBottles;



        int[] receivedBottles      = new int[GameController_mono.MaxPlayers];
        int[] receivedBottlesOrder = new int[GameController_mono.MaxPlayers];
        for (int i = 0; i < GameController_mono.MaxPlayers; ++i)
        {
            receivedBottles [i] = gameController.playerList [gameController.localPlayerN].bottlesReceived [i];
        }

        int[] givenBottles      = new int[GameController_mono.MaxPlayers];
        int[] givenBottlesOrder = new int[GameController_mono.MaxPlayers];
        for (int i = 0; i < GameController_mono.MaxPlayers; ++i)
        {
            givenBottles [i] = 0;
            for (int j = 0; j < TicketScreenController_mono.MaxColors; ++j)
            {
                givenBottles [i] += gameController.playerList [i].bottlesGiven [j];
            }
        }

        int maxBottlesColor = uniqueFirst(receivedBottles);
//		if (maxBottlesColor != -1) {
//			scoreCirculito.color = categoryColor [maxBottlesColor];
//		}

//		int secondPlayer = uniqueSecond (givenBottles);
//		if (secondPlayer != -1) {
//			gameController.playerList [secondPlayer].bottlesReceived [TicketScreenController.ClearBottle] += 7;
//			if (secondPlayer == gameController.localPlayerN) {
//				enhorabuena.scaleIn ();
//				enhorabuenaDeployed = true;
//			}
//		}
        int secondGiveScore;
        int secondNPlayers;

        secondValue(givenBottles, out secondGiveScore, out secondNPlayers);
        if (secondNPlayers > 0)
        {
            if (secondNPlayers == 1)
            {
                enhorabuenaText.text = (string)msgTable.getElement(0, 0);
            }
            else if (secondNPlayers == 2)
            {
                enhorabuenaText.text = (string)msgTable.getElement(0, 1);
            }
            else if (secondNPlayers == 3)
            {
                enhorabuenaText.text = (string)msgTable.getElement(0, 2);
            }
            for (int i = 0; i < GameController_mono.MaxPlayers; ++i)
            {
                if (gameController.playerPresent [i] && givenBottles [i] == secondGiveScore)
                {
                    gameController.playerList [i].bottlesReceived [TicketScreenController_mono.ClearBottle] += (6 / secondNPlayers);
                    if (i == gameController.localPlayerN)
                    {
                        enhorabuena.scaleIn();
                        enhorabuenaDeployed = true;
                    }
                }
            }
        }

        int totalRedBottles    = gameController.playerList [gameController.localPlayerN].bottlesReceived [TicketScreenController_mono.RedBottle];
        int totalYellowBottles = gameController.playerList [gameController.localPlayerN].bottlesReceived [TicketScreenController_mono.YellowBottle];
        int totalBlueBottles   = gameController.playerList [gameController.localPlayerN].bottlesReceived [TicketScreenController_mono.BlueBottle];
        int totalClearBottles  = gameController.playerList [gameController.localPlayerN].bottlesReceived [TicketScreenController_mono.ClearBottle];

        redScore.text    = "" + totalRedBottles;
        yellowScore.text = "" + totalYellowBottles;
        blueScore.text   = "" + totalBlueBottles;

        int totalBottles = totalRedBottles + totalYellowBottles + totalBlueBottles;

        totalClearBottlesText.text = "" + totalClearBottles;


        int totalTotalBottles = totalClearBottles + totalBottles;

        tS += totalTotalBottles;


        // tell myself
        setScore(gameController.localPlayerN, totalTotalBottles);


        this.totalScore.text = "" + tS;
    }