Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class DoorActivator : MonoBehaviour {
- public Animator[] lights;
- private Animator animator;
- void Awake () {
- animator = GetComponent <Animator>();
- }
- void OnTriggerEnter (Collider other) {
- if (other.gameObject.tag == "Player") {
- animator.SetBool ("Open", true);
- foreach (var light in lights) {
- light.SetTrigger ("Activate");
- }
- }
- }
- void OnTriggerExit (Collider other) {
- if (other.gameObject.tag == "Player") {
- animator.SetBool ("Open", false);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement