29 lines
623 B
C#
29 lines
623 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using BITKit;
|
||
|
using BITKit.Core.Entites;
|
||
|
using BITKit.Sensors;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace BITFALL.Scenes
|
||
|
{
|
||
|
public class EvacuateArea : MonoBehaviour,IAction
|
||
|
{
|
||
|
[SerializeReference, SubclassSelector] private ISensor sensor;
|
||
|
public void EvacuateScopedPlayer()
|
||
|
{
|
||
|
var players = sensor.Get()
|
||
|
.Where(x=>x.TryGetComponent<IEntity>(out _))
|
||
|
.Select(x=>x.GetComponent<IEntity>());
|
||
|
foreach (var x in players.Cast<MonoBehaviour>())
|
||
|
{
|
||
|
Destroy(x.gameObject);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void IAction.Execute() => EvacuateScopedPlayer();
|
||
|
}
|
||
|
}
|
||
|
|