| | | 1 | | using System; |
| | | 2 | | using System.Collections; |
| | | 3 | | using System.Collections.Generic; |
| | | 4 | | using UnityEngine; |
| | | 5 | | |
| | | 6 | | public class DoorOpenScript : MonoBehaviour |
| | | 7 | | { |
| | 64 | 8 | | [SerializeField] private Animator myDoor = null; |
| | 64 | 9 | | [SerializeField] private bool openTrigger = false; |
| | | 10 | | |
| | | 11 | | private SnapToTrigger snap; |
| | | 12 | | |
| | | 13 | | private void OnTriggerEnter(Collider other) |
| | 20 | 14 | | { |
| | 20 | 15 | | snap = other.GetComponent<SnapToTrigger>(); |
| | 20 | 16 | | if (other.CompareTag("Objet1")) |
| | 2 | 17 | | { |
| | 2 | 18 | | if (openTrigger) |
| | 2 | 19 | | { |
| | 2 | 20 | | snap.Snap(gameObject.transform.position); |
| | 2 | 21 | | myDoor.Play("DoorOpen",0,0.0f); |
| | 2 | 22 | | gameObject.SetActive(false); |
| | 2 | 23 | | openTrigger = false; |
| | 2 | 24 | | } |
| | 2 | 25 | | } |
| | 20 | 26 | | } |
| | | 27 | | } |