BITFALL/Assets/Artists/Scripts/Scenes/SceneDamageArea.cs

31 lines
616 B
C#
Raw Normal View History

2023-10-20 19:31:12 +08:00
using System.Collections;
using System.Collections.Generic;
using BITKit.Entities;
using UnityEngine;
2023-10-30 01:25:53 +08:00
using IEntity = BITKit.Entities.IEntity;
2023-10-20 19:31:12 +08:00
namespace BITFALL.Scenes
{
public struct SceneAreaDamage:IDamageType{
}
public class SceneDamageArea : MonoBehaviour
{
[SerializeField] private int damage = 128;
public void OnDetected(Collider other)
{
if(enabled is false) return;
if (other.TryGetComponent<Entity>(out var entity))
{
entity.Invoke<DamageMessage>(new DamageMessage()
{
2023-10-24 23:37:59 +08:00
Damage = damage,
DamageType = new SceneAreaDamage(),
Target = entity
2023-10-20 19:31:12 +08:00
});
}
}
}
}