Add initial project files and configurations for Unity setup
This commit is contained in:
29
Assets/Scripts/Infrastructure/Unity/DeathPlaneAdapter.cs
Normal file
29
Assets/Scripts/Infrastructure/Unity/DeathPlaneAdapter.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Infrastructure.Unity
|
||||
{
|
||||
[RequireComponent(typeof(BoxCollider))]
|
||||
public class DeathPlaneAdapter : MonoBehaviour
|
||||
{
|
||||
public event Action OnPlayerFell;
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.TryGetComponent<PlayerController>(out var player))
|
||||
{
|
||||
OnPlayerFell?.Invoke();
|
||||
}
|
||||
else if (other.TryGetComponent<TileViewAdapter>(out var tile))
|
||||
{
|
||||
Destroy(tile.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
Gizmos.color = new Color(1f, 0f, 0f, 0.3f);
|
||||
Gizmos.DrawCube(transform.position, transform.localScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user