35 lines
1007 B
C#
35 lines
1007 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class KillfeedMgr : MonoBehaviour
|
|
{
|
|
public static KillfeedMgr instance;
|
|
public GameObject prefab;
|
|
public Transform entryParent;
|
|
public List<KillFeedEntry> pool = new List<KillFeedEntry>();
|
|
public float entryAliveTime = 1;
|
|
|
|
void Awake(){
|
|
instance=this;
|
|
}
|
|
void Start(){
|
|
// AddNewEntry("Welcome to UPF Minigame 1.2");
|
|
}
|
|
|
|
public void AddNewEntry(string message){
|
|
return;
|
|
for(int i =0; i < pool.Count; i++){
|
|
if(!pool[i].gameObject.activeSelf){
|
|
pool[i].SetEntry(message,entryAliveTime);
|
|
return;
|
|
}
|
|
}
|
|
|
|
//No pooled item found, make new
|
|
GameObject newEntry = Instantiate(prefab, entryParent);
|
|
pool.Add(newEntry.GetComponent<KillFeedEntry>());
|
|
newEntry.GetComponent<KillFeedEntry>().SetEntry(message,entryAliveTime);
|
|
}
|
|
}
|