added freetime etc

This commit is contained in:
j.mei7
2022-03-06 16:04:18 +01:00
parent a95431b836
commit 386a0db5ff
39 changed files with 7480 additions and 199 deletions

View File

@@ -73,7 +73,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 1
m_SortingOrder: 2
m_Sprite: {fileID: -5177388603050735206, guid: 8884154dfe85442a3a3578be807dbcdf, type: 3}
m_Color: {r: 0.2509804, g: 0.32156864, b: 0.40392157, a: 1}
m_FlipX: 0

View File

@@ -11,8 +11,11 @@ GameObject:
- component: {fileID: 3391280458837659710}
- component: {fileID: 3391280458837659711}
- component: {fileID: 3391280458837659705}
- component: {fileID: 3364287627891004760}
- component: {fileID: 3391280458837659704}
- component: {fileID: 3391280458837659685}
- component: {fileID: -2258169743783008087}
- component: {fileID: 8664866673740159625}
m_Layer: 0
m_Name: Person
m_TagString: Untagged
@@ -33,7 +36,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &3391280458837659711
SpriteRenderer:
@@ -104,6 +107,23 @@ MonoBehaviour:
city: {fileID: 0}
house: {fileID: 0}
workplace: {fileID: 0}
status: 0
--- !u!114 &3364287627891004760
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3391280458837659708}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d96c0dcd94a2a7848973dd95d150cc51, type: 3}
m_Name:
m_EditorClassIdentifier:
happiness: 1
supplied: 1
suppliedDecayModifier: 0.3
happinessDecayModifier: 0.1
--- !u!114 &3391280458837659704
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -138,3 +158,40 @@ NavMeshAgent:
m_BaseOffset: 0.1
m_WalkableMask: 4294967295
m_ObstacleAvoidanceType: 4
--- !u!50 &-2258169743783008087
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3391280458837659708}
m_BodyType: 1
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 0
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!58 &8664866673740159625
CircleCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3391280458837659708}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 0.5

View File

@@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 2879071748697521147}
- component: {fileID: 2879071748697521146}
- component: {fileID: 2879071748697521145}
- component: {fileID: 175939583700583309}
m_Layer: 0
m_Name: Workplace
m_TagString: Untagged
@@ -73,7 +74,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 1
m_SortingOrder: 2
m_Sprite: {fileID: -5177388603050735206, guid: 8884154dfe85442a3a3578be807dbcdf, type: 3}
m_Color: {r: 0.40392157, g: 0.25729215, b: 0.2509804, a: 1}
m_FlipX: 0
@@ -100,4 +101,31 @@ MonoBehaviour:
space: 1
salary: 4.5
workers: []
activeWorkers: []
city: {fileID: 0}
--- !u!61 &175939583700583309
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2879071748697521144}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0.25, y: 0.25, z: 0.25, w: 0.25}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 1, y: 1}
newSize: {x: 1, y: 1}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0

File diff suppressed because it is too large Load Diff

View File

@@ -8,14 +8,15 @@ public class City : MonoBehaviour
[SerializeField]
string cityName;
[SerializeField]
List<Person> citizens = new List<Person>();
[SerializeField]
List<House> houses = new List<House>();
[SerializeField] List<Person> citizens = new List<Person>();
[SerializeField] List<House> houses = new List<House>();
[SerializeField] List<Company> companies = new List<Company>();
[SerializeField] List<Store> stores = new List<Store>();
[SerializeField] List<FreeTimeObject> freeTimeObjects = new List<FreeTimeObject>();
[SerializeField]
List<Workplace> workplaces = new List<Workplace>();
public List<Store> GetStores() => stores;
public List<FreeTimeObject> GetFreeTimeObjects() => freeTimeObjects;
public void AddCitizen(Person citizen)
{
@@ -53,21 +54,56 @@ public class City : MonoBehaviour
}
}
public void AddWorkplace(Workplace workplace)
public void AddCompany(Company company)
{
if (!workplaces.Contains(workplace))
if (!companies.Contains(company))
{
workplaces.Add(workplace);
Debug.Log("Workplace built in " + cityName);
companies.Add(company);
Debug.Log("Company built in " + cityName);
}
}
public void RemoveWorkplace(Workplace workplace)
public void RemoveCompany(Company company)
{
if (workplaces.Contains(workplace))
if (companies.Contains(company))
{
workplaces.Remove(workplace);
Debug.Log("Workplace demolished in " + cityName);
companies.Remove(company);
Debug.Log("Company demolished in " + cityName);
}
}
public void AddStore(Store store)
{
if (!stores.Contains(store))
{
stores.Add(store);
Debug.Log("Store built in " + cityName);
}
}
public void RemoveStore(Store store)
{
if (stores.Contains(store))
{
stores.Remove(store);
Debug.Log("Store demolished in " + cityName);
}
}
public void AddFreeTimeObject(FreeTimeObject freeTimeObject)
{
if (!freeTimeObjects.Contains(freeTimeObject))
{
freeTimeObjects.Add(freeTimeObject);
Debug.Log("FreeTimeObject built in " + cityName);
}
}
public void RemoveFreeTimeObject(FreeTimeObject freeTimeObject)
{
if (freeTimeObjects.Contains(freeTimeObject))
{
freeTimeObjects.Remove(freeTimeObject);
Debug.Log("FreeTimeObject demolished in " + cityName);
}
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7446318807286144ba82c0c3a884ed10
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class FreeTimeObject : MonoBehaviour
{
[Header("FreeTime Object")]
[SerializeField] string FreeTimeObjectName;
[SerializeField] City city;
private void Awake()
{
city.AddFreeTimeObject(this);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: adc5520d40289db41ae3b07650f6da07
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Park : FreeTimeObject
{
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7bc2527398280d14790a72191ef86c05
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,54 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Store : MonoBehaviour
{
[SerializeField] string storeName;
[SerializeField] City city;
[SerializeField] List<PersonIndicators> personIndicatorsInStore = new List<PersonIndicators>();
void Start()
{
city.AddStore(this);
TimeManager.OnMinuteUpdate += OnMinuteUpdate;
}
void OnMinuteUpdate()
{
foreach (PersonIndicators personIndicator in personIndicatorsInStore)
{
personIndicator.IncreaseSupplied(0.05f);
}
}
void OnTriggerEnter2D(Collider2D collision)
{
if (collision != null)
{
if(collision.GetComponent<Person>() != null)
{
if(collision.GetComponent<Person>().status == PersonStatus.STORE)
{
personIndicatorsInStore.Add(collision.GetComponent<PersonIndicators>());
}
}
}
}
private void OnTriggerExit2D(Collider2D collision)
{
if (collision != null)
{
if (collision.GetComponent<Person>() != null)
{
if (personIndicatorsInStore.Contains(collision.GetComponent<PersonIndicators>()))
{
personIndicatorsInStore.Remove(collision.GetComponent<PersonIndicators>());
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ca70058e52bdff8428269af9aeb78f80
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a292de065335c094589e9aa8012c1ad3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4f304128e3c0a464498ff313043bdace
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -32,13 +32,13 @@ public class TimeManager : MonoBehaviour
public CultureInfo cultureInfo = new CultureInfo("en-us");
DateTime dateTime = new DateTime(1, 1, 1, 0, 0, 0);
DateTime newDateTime;
DateTime prevDateTime;
float timer;
public DateTime GetDateTime() => dateTime;
public string GetTime() => dateTime.ToString("hh:mm tt", cultureInfo);
public string GetDate() => dateTime.ToString("dd/mm/yyyy", cultureInfo);
public string GetDate() => dateTime.ToString("dd/MM/yyyy", cultureInfo);
public float GetintervalTime() => intervalTime;
[Header("ReadOnly")]
@@ -54,7 +54,7 @@ public class TimeManager : MonoBehaviour
void Start()
{
timer = intervalTime;
newDateTime = dateTime;
prevDateTime = dateTime;
}
void Update()
@@ -63,25 +63,26 @@ public class TimeManager : MonoBehaviour
if (timer <= 0)
{
newDateTime = dateTime.AddMinutes(minutesPerInterval);
prevDateTime = dateTime;
if(newDateTime.Second != dateTime.Second)
OnSecondUpdate?.Invoke();
if (newDateTime.Minute != dateTime.Minute)
OnMinuteUpdate?.Invoke();
if (newDateTime.Hour != dateTime.Hour)
OnHourUpdate?.Invoke();
if(newDateTime.Day != dateTime.Day)
OnDayUpdate?.Invoke();
if(newDateTime.Month != dateTime.Month)
OnMonthUpdate?.Invoke();
if(dateTime.Year != dateTime.Year)
OnYearUpdate?.Invoke();
dateTime = newDateTime;
dateTime = dateTime.AddMinutes(minutesPerInterval);
CheckPartsOfDay();
timer = intervalTime;
readOnlyTimeString = GetTime() + " " + GetDate();
if (prevDateTime.Second != dateTime.Second)
OnSecondUpdate?.Invoke();
if (prevDateTime.Minute != dateTime.Minute)
OnMinuteUpdate?.Invoke();
if (prevDateTime.Hour != dateTime.Hour)
OnHourUpdate?.Invoke();
if (prevDateTime.Day != dateTime.Day)
OnDayUpdate?.Invoke();
if (prevDateTime.Month != dateTime.Month)
OnMonthUpdate?.Invoke();
if (dateTime.Year != dateTime.Year)
OnYearUpdate?.Invoke();
OnTimeUpdate?.Invoke();
}
}

View File

@@ -1,75 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Person : MonoBehaviour
{
[Header("Person")]
[SerializeField]
string firstName = "";
[SerializeField]
string lastName = "";
[SerializeField]
City city;
[SerializeField]
House house;
[SerializeField]
Workplace workplace;
TimeManager timeManager;
PersonMovement movement;
public bool isWorking = false;
public string GetFirstName() => firstName;
public string GetLastName() => lastName;
public string GetFullName() => firstName + " " + lastName;
TimeManager.PartOfDay prevPartOfDay;
void Awake()
{
city.AddCitizen(this);
house.AddPerson(this);
workplace.AddWorker(this);
}
void Start()
{
timeManager = GameObject.Find("GameManager").GetComponent<TimeManager>();
movement = GetComponent<PersonMovement>();
TimeManager.OnTimeUpdate += OnTimeUpdate;
}
void OnTimeUpdate()
{
if (prevPartOfDay != timeManager.partOfDay)
{
switch (timeManager.partOfDay)
{
case TimeManager.PartOfDay.NIGHT:
movement.SetTarget(house.transform);
break;
case TimeManager.PartOfDay.MORNING:
movement.SetTarget(workplace.transform);
workplace.AddActiveWorker(this);
break;
case TimeManager.PartOfDay.AFTERNOON:
break;
case TimeManager.PartOfDay.EVENING:
workplace.RemoveActiveWorker(this);
movement.SetTarget(city.transform);
break;
default:
movement.SetTarget(city.transform);
break;
}
prevPartOfDay = timeManager.partOfDay;
}
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3563d008a10e4454f85e36d820ae5364
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,124 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum PersonStatus
{
WORK,
SLEEP,
FREETIME,
PARK,
STORE,
}
public class Person : MonoBehaviour
{
[Header("Person")]
[SerializeField] string firstName = "";
[SerializeField] string lastName = "";
[SerializeField] City city;
[SerializeField] House house;
[SerializeField] Workplace workplace;
public PersonStatus status;
PersonMovement movement;
PersonIndicators indicators;
public string GetFirstName() => firstName;
public string GetLastName() => lastName;
public string GetFullName() => firstName + " " + lastName;
System.DateTime goToWorkDateTime;
void Awake()
{
city.AddCitizen(this);
house.AddPerson(this);
workplace.AddWorker(this);
}
void Start()
{
movement = GetComponent<PersonMovement>();
indicators = GetComponent<PersonIndicators>();
TimeManager.OnMinuteUpdate += OnMinuteUpdate;
TimeManager.OnDayUpdate += OnDayUpdate;
SetBehaivorDateTimes();
FreeTime();
}
void OnDayUpdate()
{
SetBehaivorDateTimes();
}
void OnMinuteUpdate()
{
// Work -> FreeTime -> Sleep
if (TimeManager.instance.GetDateTime() > goToWorkDateTime.AddHours(12)) // Sleep
{
Sleep();
}else if (TimeManager.instance.GetDateTime() > goToWorkDateTime.AddHours(8)) // FreeTime
{
FreeTime();
}
else if (TimeManager.instance.GetDateTime() > goToWorkDateTime) // Work
{
Work();
}
}
void FreeTime()
{
if(status == PersonStatus.STORE)
{
if(indicators.GetSupplied() == 1.0f)
{
status = PersonStatus.FREETIME;
}
}
else
{
status = PersonStatus.FREETIME;
}
if(indicators.GetSupplied() < 0.3f || status == PersonStatus.STORE)
{
status = PersonStatus.STORE;
Debug.Log(city.GetStores().Count - 1);
movement.SetTarget(city.GetStores()[Random.Range(0, city.GetStores().Count-1)].transform);
}
else if(status == PersonStatus.FREETIME)
{
status = PersonStatus.PARK;
movement.SetTarget(city.GetFreeTimeObjects()[Random.Range(0, city.GetFreeTimeObjects().Count)].transform);
}
}
void Work()
{
status = PersonStatus.WORK;
movement.SetTarget(workplace.transform);
}
void Sleep()
{
status = PersonStatus.SLEEP;
movement.SetTarget(house.transform);
}
void SetBehaivorDateTimes()
{
System.DateTime currentDateTime = TimeManager.instance.GetDateTime();
goToWorkDateTime = new System.DateTime(currentDateTime.Year,
currentDateTime.Month,
currentDateTime.Day,
Random.Range(4, 9),
Random.Range(0, 59),
currentDateTime.Second);
}
}

View File

@@ -0,0 +1,71 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PersonIndicators : MonoBehaviour
{
[Header("Person Indicators")]
[SerializeField] float happiness = 1f;
[SerializeField] float supplied = 1f;
[Header("Decay Modifiers")]
[SerializeField] float suppliedDecayModifier = 0.4f;
[SerializeField] float happinessDecayModifier = 0.1f;
public float GetHappiness() => happiness;
public float GetSupplied() => supplied;
void Start()
{
TimeManager.OnDayUpdate += OnDayUpdate;
}
void OnDayUpdate()
{
DecreaseSupplied(Random.Range(0.0f, suppliedDecayModifier)); // Random Percentage probability
if (supplied <= 0.2f)
{
DecreaseHappiness(happinessDecayModifier);
}
}
public void IncreaseHappiness(float value)
{
if(happiness + value <= 1f)
{
happiness += value;
}
else
{
happiness = 1f;
}
}
public void DecreaseHappiness(float value)
{
if(happiness - value >= 0f)
{
happiness -= value;
}
}
public void IncreaseSupplied(float value)
{
if (supplied + value <= 1f)
{
supplied += value;
}
else
{
supplied = 1f;
}
}
public void DecreaseSupplied(float value)
{
if (supplied - value >= 0f)
{
supplied -= value;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d96c0dcd94a2a7848973dd95d150cc51
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2cc877021b2ce184e89e653af1d3052e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a26d8707ba65181428bcfac72d953cbb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Work.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: eeb97f25d8762064d81c4a6aa5e247cd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Company : MonoBehaviour
{
[Header("Company")]
[SerializeField] string companyName = "Company";
[SerializeField] int level = 1;
[SerializeField] City city;
[SerializeField] List<Workplace> workplaces= new List<Workplace>();
void Awake()
{
city.AddCompany(this);
}
public void AddWorkplace(Workplace wp)
{
if (!workplaces.Contains(wp))
{
workplaces.Add(wp);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c8213916d698eaf4dbbeed4f986c72e4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,81 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Workplace : MonoBehaviour
{
[Header("Workplace")]
[SerializeField] int space = 1;
[SerializeField] float salary = 4.5f;
[SerializeField] List<Person> workers = new List<Person>();
[SerializeField] List<Person> activeWorkers = new List<Person>(); // Workers which are currently present and working
[SerializeField] Company company;
public void SetCompany(Company _company) => company = _company;
public void AddActiveWorker(Person worker) => activeWorkers.Add(worker);
public void RemoveActiveWorker(Person worker) => activeWorkers.Remove(worker);
void Awake()
{
company.AddWorkplace(this);
}
void Start()
{
TimeManager.OnHourUpdate += OnHourUpdate;
}
void OnTriggerEnter2D(Collider2D collision)
{
if(collision.GetComponent<Person>() != null)
{
if (workers.Contains(collision.GetComponent<Person>()))
{
if (!activeWorkers.Contains(collision.GetComponent<Person>()))
{
activeWorkers.Add(collision.GetComponent<Person>());
}
}
}
}
private void OnTriggerExit2D(Collider2D collision)
{
if (collision.GetComponent<Person>() != null)
{
if (activeWorkers.Contains(collision.GetComponent<Person>()))
{
activeWorkers.Remove(collision.GetComponent<Person>());
}
}
}
void OnHourUpdate()
{
EconomyManager.instance.AddMoney(salary * activeWorkers.Count);
}
public bool AddWorker(Person worker) // True: Worker is added - False: no enough space for worker
{
if (!workers.Contains(worker) && workers.Count < space)
{
workers.Add(worker);
Debug.Log(worker.GetFullName() + " now works");
return true;
}
else
return false;
}
public void RemoveWorker(Person worker)
{
if (workers.Contains(worker))
{
workers.Remove(worker);
Debug.Log(worker.GetFullName() + " does not work anymore");
}
}
}

View File

@@ -1,59 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Workplace : MonoBehaviour
{
[Header("Workplace")]
[SerializeField]
int space = 1;
[SerializeField]
float salary = 4.5f;
[SerializeField]
List<Person> workers = new List<Person>();
[SerializeField]
List<Person> activeWorkers = new List<Person>(); // Workers which are currently present and working
[SerializeField]
City city;
public void AddActiveWorker(Person worker) => activeWorkers.Add(worker);
public void RemoveActiveWorker(Person worker) => activeWorkers.Remove(worker);
void Awake()
{
city.AddWorkplace(this);
}
void Start()
{
TimeManager.OnHourUpdate += OnHourUpdate;
}
void OnHourUpdate()
{
EconomyManager.instance.AddMoney(salary * activeWorkers.Count);
}
public void AddWorker(Person worker)
{
if (!workers.Contains(worker) && workers.Count < space)
{
workers.Add(worker);
Debug.Log(worker.GetFullName() + " now works");
}
}
public void RemoveWorker(Person worker)
{
if (workers.Contains(worker))
{
workers.Remove(worker);
Debug.Log(worker.GetFullName() + " does not work anymore");
}
}
}