Example #1
0
 // Use this for initialization
 void Start()
 {
     for (int i = 0; i < door.Length; i++)
     {
         doorScript = door[i].GetComponent<Door>();
         doorScript.OpenSeseme();
     }
 }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.E) && canActivate == true)
     {
         for (int i = 0; i < door.Length; i++)
         {
             doorScript = door[i].GetComponent<Door>();
             doorScript.isActivated = !doorScript.isActivated;
             doorScript.OpenSeseme();
         }
     }
 }
Example #3
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if(other.gameObject.tag == "Player" && isSwitch == false || other.gameObject.tag == "Heavy Object" && isSwitch == false)
     {
         for (int i = 0; i < door.Length; i++)
         {
             doorScript = door[i].GetComponent<Door>();
             doorScript.isActivated = !doorScript.isActivated;
             doorScript.OpenSeseme();
         }
     }
 }