This can be seen as the initial state of the project after the released demo.
The changes include:
- New ship models
- Singleton manager structure to keep project scaleable in the future
- Managing players, their settings, character choices, statistics, match setups, controls etc. in a separate decoupled scene
- Main menu with transitions to the arena scene
- Beginnings of a custom audio solution
- Logging with Log4Net
It is really a complete overhaul of the projects structure and management.
72 lines
1.5 KiB
C#
72 lines
1.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
|
|
public class Announcments : MonoBehaviour
|
|
{
|
|
[SerializeField] TextMeshProUGUI announcementText;
|
|
|
|
public Queue<Tuple<string, float>> announcementQueue = new Queue<Tuple<string, float>>();
|
|
private bool workingOnQueue = false;
|
|
private float remainingTime;
|
|
|
|
void Update()
|
|
{
|
|
if (!workingOnQueue && announcementQueue.Count != 0)
|
|
{
|
|
workingOnQueue = true;
|
|
Tuple<string, float> announcement = announcementQueue.Dequeue();
|
|
AnnounceText(announcement.Item1, announcement.Item2);
|
|
return;
|
|
}
|
|
if (remainingTime > 0)
|
|
{
|
|
remainingTime -= Time.deltaTime;
|
|
}
|
|
else
|
|
{
|
|
workingOnQueue = false;
|
|
announcementText.enabled = false;
|
|
remainingTime = 0;
|
|
if (announcementQueue.Count == 0)
|
|
{
|
|
enabled = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void AnnounceText(string text, float time)
|
|
{
|
|
announcementText.text = text;
|
|
announcementText.enabled = true;
|
|
remainingTime = time;
|
|
enabled = true;
|
|
}
|
|
|
|
public void QueueAnnounceText(string text, float time)
|
|
{
|
|
announcementQueue.Enqueue(new Tuple<string, float>(text, time));
|
|
enabled = true;
|
|
}
|
|
|
|
public void AnnounceText(string text)
|
|
{
|
|
announcementText.text = text;
|
|
announcementText.enabled = true;
|
|
announcementQueue.Clear();
|
|
enabled = false;
|
|
}
|
|
|
|
public void StopAnnouncement()
|
|
{
|
|
announcementQueue.Clear();
|
|
announcementText.text = String.Empty;
|
|
remainingTime = 0;
|
|
announcementText.enabled = false;
|
|
enabled = false;
|
|
}
|
|
}
|