Example #1
0
 private void Update()
 {
     s[0]  = s0.on_off;
     s[1]  = s1.on_off;
     s[2]  = s2.on_off;
     s[3]  = s3.on_off;
     s[4]  = s4.on_off;
     s[5]  = s5.on_off;
     s[6]  = s6.on_off;
     s[7]  = s7.on_off;
     s[8]  = s8.on_off;
     s[9]  = s9.on_off;
     s[10] = s10.on_off;
     s[11] = s11.on_off;
     s[12] = s12.on_off;
     s[13] = s13.on_off;
     s[14] = s14.on_off;
     s[15] = s15.on_off;
     //0 2 5 7 10 11 12
     if (s[0] == 1 &&
         s[1] == 0 &&
         s[2] == 1 &&
         s[3] == 0 &&
         s[4] == 0 &&
         s[5] == 1 &&
         s[6] == 0 &&
         s[7] == 1 &&
         s[8] == 0 &&
         s[9] == 0 &&
         s[10] == 1 &&
         s[11] == 1 &&
         s[12] == 1 &&
         s[13] == 0 &&
         s[14] == 0 &&
         s[15] == 0
         )
     {
         s0.Open();
         s1.Open();
         s2.Open();
         s3.Open();
         s4.Open();
         s5.Open();
         s6.Open();
         s7.Open();
         s8.Open();
         s9.Open();
         s10.Open();
         s11.Open();
         s12.Open();
         s13.Open();
         s14.Open();
         s15.Open();
         //Debug.Log("Open");
         islocked = false;
         transform.GetChild(1).gameObject.GetComponent <SpriteRenderer>().sprite =
             Resources.Load <Sprite>("livingroomsprites/numpad");
         if (lastplayed != 1 && lastplayed != 3)
         {
             audiosrc.PlayOneShot(Resources.Load <AudioClip>("SoundEffects/doorunlock"));
             lastplayed = 1;
         }
     }
 }