void Awake() { doorSound = GetComponentInChildren <DoorSound>(); doorAnim = GetComponentInChildren <Animator>(); doorTransform = transform.transform; fStep = transform.Find("FStep").transform; bStep = transform.Find("BStep").transform; if (HasComponent <Locked>()) { state = DoorState.Locked; locked = GetComponent <Locked>(); } else if (HasComponent <SecretController>()) { state = DoorState.Secret; secretController = GetComponent <SecretController>(); } else if (HasComponent <DirLockController>()) { state = DoorState.DirLock; dirLockController = GetComponent <DirLockController>(); } else { state = DoorState.Open; } }
void OnTriggerEnter(Collider other) { //TODO: change this, transform.root is not always good // doorrotation = transform.root.GetComponentInChildren<DoorRotation>(); //What's the best method here?? doorrotation = transform.parent.transform.parent.transform.GetComponentInChildren <DoorRotation>(); if (transform.root.GetComponentInChildren <DoorSound>() != null) { doorsound = transform.root.GetComponentInChildren <DoorSound>(); } else { doorsound = null; } doordetection = GameObject.FindGameObjectWithTag("Player").GetComponent <DoorDetection>(); }
void Update() { if (Camera.main.GetComponent <RasmusRaycast> ().HoldObject != null) { DoorSound doorSound = Camera.main.GetComponent <RasmusRaycast> ().HoldObject.GetComponent <DoorSound>(); if (doorSound != null) { // Debug.Log (doorSound.transform.position); m_ThisDoor = doorSound.gameObject; PlaySound(); } } var attributes = UnityUtil.to3DAttributes(m_GameObject); ERRCHECK(m_Event.set3DAttributes(attributes)); }