First Reward system (Gold)

This commit is contained in:
Antoine H 2021-01-07 14:45:19 +01:00
parent caf73dfc25
commit 998cc81e0a
5 changed files with 33 additions and 6 deletions

View file

@ -6,7 +6,7 @@ using UnityEditor;
//Define the system managing the clients. (Singleton)
public sealed class ClientManager : MonoBehaviour
{
int nbMaxClients = 10;
int nbMaxClients = 1;
bool clientSpawnReady = false;
float clientSpawnTimer = 0.5f; //Intial time before first spawn (pseudo-random after that)
float maxTimeNewClients = 2.0f;
@ -40,6 +40,12 @@ public sealed class ClientManager : MonoBehaviour
return false; //No new client
}
//TODO: Reputation
public void clientReward(int money)
{
GameSystem.Instance.gold+=money;
}
//Destroy a client
public void clientLeave(GameObject client)
{

View file

@ -14,6 +14,20 @@ public sealed class GameSystem : MonoBehaviour
float slowScale = 0.5f; //Default scale for slow mode
private float fixedDeltaTime;
//TODO : Effect on gold change
//Money
private int _gold;
public int gold
{
get{return _gold;}
set{
if(value<0)
value=0;
_gold = value;
Debug.Log("Gold : "+_gold);
}
}
public void startService()
{
serviceTimer=serviceTime;
@ -71,6 +85,7 @@ public sealed class GameSystem : MonoBehaviour
void Start()
{
startService();
gold=0;
}
// Update is called once per frame