Compare commits

...

2 Commits

Author SHA1 Message Date
37cfdd2220 포탈 생성 2026-01-12 13:17:47 +09:00
91a74bef5a 누락된 Material 변경 사항 추가 2026-01-12 13:17:38 +09:00
7 changed files with 33 additions and 6 deletions

View File

@@ -28,7 +28,7 @@ Material:
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MainTex: - _MainTex:
m_Texture: {fileID: 0} m_Texture: {fileID: 2800000, guid: 8e4f24f3ea4a0ed488c8b0abf392ab7a, type: 3}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MaskTex: - _MaskTex:

View File

@@ -28,7 +28,7 @@ Material:
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MainTex: - _MainTex:
m_Texture: {fileID: 0} m_Texture: {fileID: 2800000, guid: 2d8756227812cb6418ddf659e94f7226, type: 3}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MaskTex: - _MaskTex:

View File

@@ -28,7 +28,7 @@ Material:
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MainTex: - _MainTex:
m_Texture: {fileID: 0} m_Texture: {fileID: 2800000, guid: 28b82a4e8f1aa2e4faf3492c62086bce, type: 3}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MaskTex: - _MaskTex:

View File

@@ -28,7 +28,7 @@ Material:
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MainTex: - _MainTex:
m_Texture: {fileID: 0} m_Texture: {fileID: 2800000, guid: c9946b141fc71a64c958f9fcd9e718cf, type: 3}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MaskTex: - _MaskTex:

View File

@@ -151,8 +151,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 1c203980d40e2bf4392783aade147dca, type: 3} m_Script: {fileID: 11500000, guid: 1c203980d40e2bf4392783aade147dca, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: Assembly-CSharp::EnemyAttack m_EditorClassIdentifier: Assembly-CSharp::EnemyAttack
damage: 20 damage: 1
attackCooldown: 1 attackCooldown: 5
--- !u!114 &7188026176818599596 --- !u!114 &7188026176818599596
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@@ -0,0 +1,27 @@
using UnityEngine;
public class Portal : MonoBehaviour
{
[SerializeField] private Transform destination; // 순간이동할 목적지 (반대편 포탈의 위치)
[SerializeField] private float cooldown = 1f; // 연속 이동 방지 쿨타임
private float _lastTeleportTime;
private void OnTriggerEnter(Collider other)
{
// 플레이어 태그 확인 및 쿨타임 체크
if (other.CompareTag("Player") && Time.time > _lastTeleportTime + cooldown)
{
// 상대방 포탈의 쿨타임도 같이 설정해야 무한 루프를 방지함
Portal destPortal = destination.GetComponent<Portal>();
if (destPortal != null) destPortal._lastTeleportTime = Time.time;
_lastTeleportTime = Time.time;
// 플레이어 위치 이동
// CharacterController나 Rigidbody를 사용 중이라면 이동 방식에 주의
other.transform.position = destination.position;
Debug.Log("Teleported to " + destination.name);
}
}
}