fix: 캐릭터가 벽에 충돌했을때 추락하게 하도록 로직 적용
This commit is contained in:
24
Gameton-06/Assets/Gameton/Scripts/Character/WallChecker.cs
Normal file
24
Gameton-06/Assets/Gameton/Scripts/Character/WallChecker.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
public class WallChecker : MonoBehaviour
|
||||
{
|
||||
public bool IsWallTouching { get; private set; }
|
||||
|
||||
private void OnTriggerStay2D(Collider2D other)
|
||||
{
|
||||
IsWallTouching = other.gameObject.layer == LayerMask.NameToLayer("Ground");
|
||||
}
|
||||
|
||||
private void OnTriggerExit2D(Collider2D other)
|
||||
{
|
||||
if (other.gameObject.layer == LayerMask.NameToLayer("Ground"))
|
||||
{
|
||||
IsWallTouching = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user