Notice
Recent Posts
Recent Comments
Link
«   2026/05   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Archives
Today
Total
관리 메뉴

moonee-e3 님의 블로그

2024-06-14 | 포탈_닿으면 플레이어 위치 이동 본문

개발 일지 [3D | Dream Forest]

2024-06-14 | 포탈_닿으면 플레이어 위치 이동

moonee-e3 2024. 6. 22. 15:49
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Portal : MonoBehaviour
{
    public Transform _portal;
    public Transform Player;

    private AudioSource PortalEff;
    public AudioClip PortalClip;

    private void Start()
    {
        PortalEff = GetComponent<AudioSource>();
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            PortalEff.PlayOneShot(PortalClip);
            Player.position = _portal.position;
        }
    }
}