moonee-e3 님의 블로그
2024-06-14 | 포탈_닿으면 플레이어 위치 이동 본문
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;
}
}
}
'개발 일지 [3D | Dream Forest]' 카테고리의 다른 글
| 2024-06-19 | SoundManager (0) | 2024.06.23 |
|---|---|
| 204-06-14 | 움직이는 땅 (0) | 2024.06.23 |
| 2024-05-31 | 3D에서 2D 스프라이트 화면에 맞게 나타내기 (0) | 2024.06.22 |
| 2024-05-25 같은 위치 반복해서 움직이는 적 (0) | 2024.06.22 |
| 2024-05-28 시야각에 들어오면 죽이는 적 구현 (0) | 2024.06.21 |