Compare commits
2 Commits
5e2eaee44b
...
37cfdd2220
| Author | SHA1 | Date | |
|---|---|---|---|
| 37cfdd2220 | |||
| 91a74bef5a |
@@ -28,7 +28,7 @@ Material:
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Texture: {fileID: 2800000, guid: 8e4f24f3ea4a0ed488c8b0abf392ab7a, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MaskTex:
|
||||
|
||||
@@ -28,7 +28,7 @@ Material:
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Texture: {fileID: 2800000, guid: 2d8756227812cb6418ddf659e94f7226, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MaskTex:
|
||||
|
||||
@@ -28,7 +28,7 @@ Material:
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Texture: {fileID: 2800000, guid: 28b82a4e8f1aa2e4faf3492c62086bce, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MaskTex:
|
||||
|
||||
@@ -28,7 +28,7 @@ Material:
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Texture: {fileID: 2800000, guid: c9946b141fc71a64c958f9fcd9e718cf, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MaskTex:
|
||||
|
||||
@@ -151,8 +151,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 1c203980d40e2bf4392783aade147dca, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::EnemyAttack
|
||||
damage: 20
|
||||
attackCooldown: 1
|
||||
damage: 1
|
||||
attackCooldown: 5
|
||||
--- !u!114 &7188026176818599596
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
Binary file not shown.
27
Assets/Scripts/GameBase/Portal.cs
Normal file
27
Assets/Scripts/GameBase/Portal.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user