| | | 1 | | using System.Collections; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using UnityEngine; |
| | | 4 | | |
| | | 5 | | public class room2_trigger : MonoBehaviour |
| | | 6 | | { |
| | | 7 | | [SerializeField] private bool checkSphere; |
| | | 8 | | [SerializeField] private bool checkCube; |
| | | 9 | | [SerializeField] private bool checkPyramid; |
| | | 10 | | [SerializeField] private room2 roomDatas; |
| | | 11 | | |
| | | 12 | | private SnapToTrigger snap; |
| | | 13 | | |
| | | 14 | | private void OnTriggerEnter(Collider collision) |
| | 8 | 15 | | { |
| | 8 | 16 | | snap = collision.GetComponent<SnapToTrigger>(); |
| | 8 | 17 | | if (checkSphere && collision.CompareTag("Sphere")) { |
| | 0 | 18 | | roomDatas.SetSphereCheck(); |
| | 0 | 19 | | snap.Snap(gameObject.transform.position); |
| | 0 | 20 | | } |
| | 8 | 21 | | else if (checkPyramid && collision.CompareTag("Pyramid")) |
| | 0 | 22 | | { |
| | 0 | 23 | | roomDatas.SetPyramidCheck(); |
| | 0 | 24 | | snap.Snap(gameObject.transform.position); |
| | 0 | 25 | | } |
| | 8 | 26 | | else if (checkCube && collision.CompareTag("Cube")) |
| | 1 | 27 | | { |
| | 1 | 28 | | roomDatas.SetCubeCheck(); |
| | 1 | 29 | | snap.Snap(gameObject.transform.position); |
| | 1 | 30 | | } |
| | 8 | 31 | | } |
| | | 32 | | } |