Exemplo n.º 1
0
 public void crack()
 {
     theImage.enabled = true;
     theImage.sprite  = crackedGlass [0];
     levelController.playSound(crackAudio [0]);
     theImage.color  = new Color(1, 1, 1, 1);
     elapsedTime     = 0.0f;
     nextTimeToCrack = FloatRandom.floatRandomRange(minTimeToCrack, maxTimeToCrack);
     state           = HUDCrackGlassState.cracking;
     ds.storeBoolValue("IsHUDCracked", true);
 }
Exemplo n.º 2
0
    public void changeActivity()
    {
        if (state != HUDCrackGlassState.cracked)
        {
            return;
        }
        waitFrames = 2;
        CameraUtils cgrab = cam.GetComponent <CameraUtils> ();

        cgrab.grab();
        state = HUDCrackGlassState.changingActivity;
    }
Exemplo n.º 3
0
    // Use this for initialization
    new void Start()
    {
        state            = HUDCrackGlassState.idle;
        theImage         = this.GetComponent <Image> ();
        theImage.color   = new Color(0, 0, 0, 0);
        theImage.enabled = false;
        elapsedTime      = 0.0f;
        waitFrames       = 2;

        master = GameObject.Find("MasterController").GetComponent <MasterControllerScript> ();
        ds     = master.getStorage();
        if (ds.retrieveBoolValue("IsHUDCracked"))
        {
            state            = HUDCrackGlassState.cracked;
            theImage.enabled = true;
            theImage.color   = new Color(1, 1, 1, 1);
            theImage.sprite  = crackedGlass [crackedGlass.Length - 1];
        }
        levelController = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
        cam             = GameObject.Find("Main Camera").GetComponent <Camera>();
    }
Exemplo n.º 4
0
    // Update is called once per frame
    new void Update()
    {
        if (state == HUDCrackGlassState.cracking)
        {
            elapsedTime += Time.deltaTime;
            if (elapsedTime > nextTimeToCrack)
            {
                elapsedTime     = 0.0f;
                nextTimeToCrack = FloatRandom.floatRandomRange(minTimeToCrack, maxTimeToCrack);
                if (frame < crackedGlass.Length - 1)
                {
                    ++frame;
                    theImage.sprite = crackedGlass [frame];
                    levelController.playSound(crackAudio [frame]);
                }
                else
                {
                    state = HUDCrackGlassState.cracked;
                }
            }
        }

        if (state == HUDCrackGlassState.cracked)
        {
        }

        if (state == HUDCrackGlassState.changingActivity)
        {
            --waitFrames;
            if (waitFrames == 0)
            {
                ds.storeStringValue("ReturnLocation", levelController.locationName);
                levelController.storeStringValue("CurrentLevel", levelController.locationName);
                levelController.storePlayerCoordinates();
                SceneManager.LoadScene("Scenes/QA");
            }
        }
    }