diff --git a/Assets/Scripts/GameSystems.meta b/Assets/Scripts/GameSystems.meta new file mode 100644 index 0000000..91dfe8a --- /dev/null +++ b/Assets/Scripts/GameSystems.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f936e977ecaeacc44818a09cfebd7de1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/GameSystems/ClientManager.cs b/Assets/Scripts/GameSystems/ClientManager.cs new file mode 100644 index 0000000..b237a8d --- /dev/null +++ b/Assets/Scripts/GameSystems/ClientManager.cs @@ -0,0 +1,86 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +//Define the system managing the clients. (Singleton) +public sealed class ClientManager : MonoBehaviour +{ + int currentNbClient = 0; + int nbMaxClients = 1; + bool clientSpawnReady = false; + float clientSpawnTimer = 2.0f; //Intial time before first spawn (pseudo-random after that) + float maxTimeNewClients = 10.0f; + + string ClientRessourceFolder = "Clients"; + Vector3 spawnPosition = new Vector3(0, 0, 0); + private Object[] clients; + + //Request new client + //Return wether a new client was created + public bool clientRequest() + { + if(clientSpawnReady && currentNbClient(); + } + //// +} diff --git a/Assets/Scripts/GameSystems/ClientManager.cs.meta b/Assets/Scripts/GameSystems/ClientManager.cs.meta new file mode 100644 index 0000000..ebfa94a --- /dev/null +++ b/Assets/Scripts/GameSystems/ClientManager.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 2bc1593400bcb054db0179d45fa332e9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: + - clientPrefab: {fileID: 5304524770463492230, guid: 2dde00c8c5857d2438fd92435d8c3abb, + type: 3} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/GameSystem.cs b/Assets/Scripts/GameSystems/GameSystem.cs similarity index 96% rename from Assets/Scripts/GameSystem.cs rename to Assets/Scripts/GameSystems/GameSystem.cs index a3fe004..5449da8 100644 --- a/Assets/Scripts/GameSystem.cs +++ b/Assets/Scripts/GameSystems/GameSystem.cs @@ -4,7 +4,6 @@ using UnityEngine; using System; //Exceptions //Define the global game system of the service. (Singleton) -//TODO : Split gamesystem into subsystem ? public sealed class GameSystem : MonoBehaviour { //Time @@ -14,10 +13,6 @@ public sealed class GameSystem : MonoBehaviour float slowScale = 0.5f; //Default scale for slow mode private float fixedDeltaTime; - //Clients - // int nbMaxClients = 2; - // float freqNewClients = 3.0f; - public void startService() { serviceTimer=serviceTime; @@ -75,6 +70,8 @@ public sealed class GameSystem : MonoBehaviour serviceTimer-= Time.deltaTime; if (serviceTimer < 0) serviceOpen = false; + + ClientManager.Instance.clientRequest(); } //Temporary manual slowmode toggle diff --git a/Assets/Scripts/GameSystem.cs.meta b/Assets/Scripts/GameSystems/GameSystem.cs.meta similarity index 100% rename from Assets/Scripts/GameSystem.cs.meta rename to Assets/Scripts/GameSystems/GameSystem.cs.meta