Exemplo n.º 1
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     if(collision == player.GetComponent<Collider2D>())
     {
         if (key)
         {
             if (!narrator.source.isPlaying)
             {
                 player.position = where;
             }
         }
         else {
             if (maze)
             {
                 if (timer > 5)
                 {
                     player.position = where;
                     timer = 0;
                 }
                 if (player.GetComponent<Rigidbody2D>().velocity == new Vector2(0, 0))
                 {
                     timer += Time.deltaTime;
                 }
                 else
                 {
                     timer = 0;
                 }
             }
             else
             {
                 timer += Time.deltaTime;
                 Debug.Log(timer);
                 if (timer > 3 && Physics2D.gravity.y < 0)
                 {
                     if (narrator.played[aud] == 0 && canPlay && aud != 9)
                     {
                         narrator.PlayClip(aud);
                         aud++;
                         canPlay = false;
                     }
                     if (!narrator.source.isPlaying)
                     {
                         player.position = where;
                         canPlay = true;
                         timer = 0;
                         if (times >= limit && limit != 0)
                         {
                             player.position = where2;
                             narrator.PlayClip(9);
                             Destroy(this);
                         }
                         times++;
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 private void Update()
 {
     if (Input.anyKeyDown && !hasClicked)
     {
         hasClicked = true;
         StartCoroutine("StartGame");
         narrator.PlayClip(0);
     }
 }
Exemplo n.º 3
0
 public void Action()
 {
     if (narrator.played[aud] == 0)
     {
         narrator.PlayClip(aud);
     }
     textMesh.SetTrigger("Opened");
     isOn = false;
     transform.position = off;
     door.GetComponent <Rigidbody2D>().isKinematic = true;
 }