UPF/Assets/Game/Scripts/Minigame/KillfeedMgr.cs
2023-02-24 22:14:55 +05:30

35 lines
1007 B
C#
Executable File

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);
}
}