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