예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (lastTriggerState != trigger.GetTriggerState())
     {
         lastTriggerState = trigger.GetTriggerState();
         if (lastTriggerState)
         {
             //play open
             if (sfxActivated != null)
             {
                 audio.clip = sfxActivated;
             }
         }
         else
         {
             //play close
             if (sfxDeactivated != null)
             {
                 audio.clip = sfxDeactivated;
             }
         }
         audio.Play();
     }
 }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     trigger          = GetComponent <DoorTrigger>();
     lastTriggerState = trigger.GetTriggerState();
 }