31 lines
620 B
C#
31 lines
620 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using BITKit.Entities;
|
||
|
using UnityEngine;
|
||
|
using IEntity = BITKit.Core.Entites.IEntity;
|
||
|
|
||
|
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()
|
||
|
{
|
||
|
damage = damage,
|
||
|
damageType = new SceneAreaDamage(),
|
||
|
target = entity
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|