feat(VoidKillZone): 实现玩家直接死亡空气墙
This commit is contained in:
17
Assets/Script/Gameplay/Facility/VoidKillZone.cs
Normal file
17
Assets/Script/Gameplay/Facility/VoidKillZone.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
using Script.Gameplay.Player;
|
||||
|
||||
namespace Script.Gameplay.Facility
|
||||
{
|
||||
public class VoidKillZone : MonoBehaviour
|
||||
{
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
var player = other.GetComponent<PlayerController>();
|
||||
if (player != null)
|
||||
{
|
||||
player.TakeDamage(player.CurrentHealth); // 直接扣光血量
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user