Ejemplo n.º 1
0
 public void _wa_showPercentage(WisdominiObject waiter)
 {
     this.waitingRef = waiter;
     alert._wa_setAlertMessage(this, "Tarjetas configuradas al " + calculatePercetage() + "%");
     alert.programNotification    = -1;
     isWaitingForActionToComplete = true;
     state = 1;
 }
    new void Update()
    {
        if (state == 1)
        {
            if (!alert._wm_isOpen())
            {
                state = 4;
            }
        }

        if (state == 2)
        {
            if (!alert._wm_isOpen())
            {
                state = 5;
            }
        }

        if (state == 3)
        {
            if (!alert._wm_isOpen())
            {
                state = 6;
            }
        }

        if (state == 4)
        {
            level.player.unblockControls();
            door._wm_open();
            state = 0;
        }

        if (state == 5)
        {
            level.player.unblockControls();
            FerfufloController.resetFerfufloAnswers(level.mcRef);
            state = 0;
        }

        if (state == 6)
        {
            alert._wa_setAlertMessage(this, "Tarjetas configuradas al " + percent + "%  Es necesario que las tarjetas estén configuradas al 100%");
            this.isWaitingForActionToComplete = true;
            alert.programNotification         = -1;

            state = 7;
        }

        if (state == 7)
        {
            if (!isWaitingForActionToComplete)
            {
                level.player.unblockControls();
                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;
            }
        }
    }