i have a script of lever now i have three levers which have different door transform assinged in inspector now when i interact with one lever all lever gets called and all doors got opened.
public class LeverScript : MonoBehaviour {
public Transform Dungeonlever1;
public Transform door;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetButtonDown (“Interact”)) {
print (“helo”);
if (door.CompareTag (“Type1Door”)) {
print (“hi”);
GetComponent ().Play (“FlipLeft”);
transform.GetComponent ().enabled = false;
StartCoroutine (wait ());
}
else if (door.CompareTag (“Type2Door”)) {
print (“ihello”);
GetComponent ().Play (“FlipLeft”);
transform.GetComponent ().enabled = false;
StartCoroutine (wait ());
}
}
}
IEnumerator wait(){
yield return new WaitForSeconds (2f);
door.GetComponent ().Play (“in-open-slowly”);
GetComponent ().enabled = false;
yield return new WaitForSeconds (2f);
//GetComponent ().isTrigger = false;
door.GetComponent ().enabled = false;
door.GetComponent ().enabled = false;
}
}