30 lines
647 B
C#
30 lines
647 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using NaughtyAttributes;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
|
|
|
|
public class NpcDeadCall : MonoBehaviour
|
|
{
|
|
[FormerlySerializedAs("Npc")] public List<NPC> npc = new List<NPC>();
|
|
private void Awake()
|
|
{
|
|
npc = FindObjectsOfType<NPC>().ToList();
|
|
}
|
|
[Button()]
|
|
public void Call()
|
|
{
|
|
StartCoroutine(BeakProcess());
|
|
}
|
|
public IEnumerator BeakProcess()
|
|
{
|
|
foreach (var _npc in npc)
|
|
{
|
|
yield return new WaitForSeconds(1.5f);
|
|
_npc.Dead();
|
|
}
|
|
}
|
|
} |