Compare commits

..

No commits in common. "3bdf7231e313deb32176d2b70c1281b362702f29" and "a0c4ce5ec1b80131e254ed70649b33b1a1ffeb20" have entirely different histories.

9 changed files with 55 additions and 283 deletions

View File

@ -282,10 +282,10 @@ MonoBehaviour:
m_EditorClassIdentifier:
IsOn: 0
_turnOnTime:
_hour: 21
_hour: 0
_minutes: 0
_turnOffTime:
_hour: 6
_hour: 0
_minutes: 0
--- !u!4 &37507749
Transform:
@ -427,7 +427,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_daysUntilRelease: 20
_secondsPerDay: 20
_secondsPerDay: 5
_totalTime: 0
_sun: {fileID: 179279866}
--- !u!4 &227416519
@ -461,7 +461,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &266099154
Transform:
m_ObjectHideFlags: 0
@ -489,8 +489,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a61873b0f5608a44982d48387f34f682, type: 3}
m_Name:
m_EditorClassIdentifier:
ZombiePrefab: {fileID: 856601670117699726, guid: a34b2d22562c7214f9daf0d3dea8d85c, type: 3}
_spawnRate: 2
ZombiePrefab: {fileID: 0}
_spawnRate: 1
_spawnTimer: 0
--- !u!1001 &514859708
PrefabInstance:
@ -502,7 +502,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 958156999735417459, guid: 7c7f0805c6bdc4f41bd65ec128f6b658, type: 3}
propertyPath: m_LocalPosition.x
value: 28.09
value: 28.41
objectReference: {fileID: 0}
- target: {fileID: 958156999735417459, guid: 7c7f0805c6bdc4f41bd65ec128f6b658, type: 3}
propertyPath: m_LocalPosition.y
@ -510,7 +510,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 958156999735417459, guid: 7c7f0805c6bdc4f41bd65ec128f6b658, type: 3}
propertyPath: m_LocalPosition.z
value: -5.49
value: -3.352
objectReference: {fileID: 0}
- target: {fileID: 958156999735417459, guid: 7c7f0805c6bdc4f41bd65ec128f6b658, type: 3}
propertyPath: m_LocalRotation.w
@ -616,8 +616,6 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 4294967295
grounded: 0
_hand: {fileID: 0}
_carriedItem: {fileID: 0}
--- !u!1 &547927580
GameObject:
m_ObjectHideFlags: 0
@ -1279,7 +1277,6 @@ MonoBehaviour:
_hungerNeed: {fileID: 0}
_wantedFood: 0
_toiletNeed: {fileID: 0}
_maxPrivateContextBufferSize: 5
_talkTimer: 10
--- !u!4 &983523620
Transform:
@ -1313,8 +1310,6 @@ MonoBehaviour:
speakingSpeed: 1.1
playSound: 0
generate: 0
newVoice: 0
Voice:
--- !u!114 &983523622
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1886,10 +1881,6 @@ PrefabInstance:
propertyPath: _player
value:
objectReference: {fileID: 514859709}
- target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
propertyPath: _maxContextBufferSize
value: 3
objectReference: {fileID: 0}
- target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
propertyPath: _developers.Array.size
value: 1
@ -2090,8 +2081,6 @@ MonoBehaviour:
speakingSpeed: 1.1
playSound: 0
generate: 0
newVoice: 0
Voice:
--- !u!114 &1814492793
MonoBehaviour:
m_ObjectHideFlags: 0
@ -2146,7 +2135,6 @@ MonoBehaviour:
_hungerNeed: {fileID: 0}
_wantedFood: 0
_toiletNeed: {fileID: 0}
_maxPrivateContextBufferSize: 2
_talkTimer: 10
--- !u!82 &1814492795
AudioSource:

View File

@ -1,9 +1,7 @@
using Microsoft.VisualStudio.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using UnityEngine;
using UnityEngine.Serialization;
using Utility;
@ -102,52 +100,31 @@ public class Developer : MonoBehaviour
[SerializeField]
private GameObject _caffeineNeed;
[SerializeField]
private WantedConsumable _wantedDrink;
[SerializeField] private WantedConsumable _wantedDrink;
[SerializeField]
private GameObject _hungerNeed;
[SerializeField]
private WantedConsumable _wantedFood;
[SerializeField] private WantedConsumable _wantedFood;
[SerializeField]
private GameObject _toiletNeed;
private List<GameObject> _needList = new List<GameObject>();
private bool _isDead = false;
/// <summary>
/// indicates wether the Dev is dead or not
/// </summary>
public bool IsDead => _isDead;
[SerializeField]
private int _maxPrivateContextBufferSize = 2;
[SerializeField]
private CircularBuffer<string> _privateContextBuffer;
/// <summary>
/// Returns the private Context Buffer
/// </summary>
public CircularBuffer<string> PrivateContextBuffer => _privateContextBuffer;
// stuff for talking
[SerializeField, ShowOnly]
private float _talkTimer;
private AudioSource _audioSource;
private float _talkPauseTime = 15.0f;
[SerializeField, ShowOnly]
private float _talkTimer;
private bool _hasTalkedWhileHyperactive = false;
private bool _hasTalkedWhileOvercaffeinated = false;
private bool _hasTalkedBeforeSleeping = false;
private List<GameObject> _needList = new List<GameObject>();
void Start()
{
_developerNeeds = gameObject.GetComponent<DeveloperNeeds>();
_audioSource = GetComponent<AudioSource>();
_talkTimer = Random.Range(5.0f, 15.0f);
_talkTimer = UnityEngine.Random.Range(5.0f, 15.0f);
_fingersLeft = _baseStats.Fingers;
_privateContextBuffer = new CircularBuffer<string>(_maxPrivateContextBufferSize);
}
private void Update()
@ -164,12 +141,6 @@ public class Developer : MonoBehaviour
}
}
[ContextMenu("Hurt him")]
private void TestHurt()
{
Hurt();
}
[ContextMenu("Give Coffee")]
private void TestCoffee()
{
@ -215,14 +186,12 @@ public class Developer : MonoBehaviour
// TODO: Wie wäre es damit, das nicht fest zu coden?
if (drinkType == _wantedDrink)
{
Talk($"The Developer thanks Gottfried for the {drinkType.GetAsString()}", 1);
_privateContextBuffer.Add($"The Developer is greatful for the {drinkType.GetAsString()} Gottfried brought him a while ago");
Talk($"The Devolper thanks Gottfried for the {drinkType.GetAsString()}");
_happiness += 0.2;
}
else
{
Talk($"The Developer is happy about the caffeine but he blames Gottfried for bringing {drinkType.GetAsString()} because he actaully wanted a {_wantedDrink.GetAsString()} instead", 0, true);
_privateContextBuffer.Add($"The Developer is still annoyed and reminds Gottfried that he brought him {drinkType.GetAsString()} instead of {_wantedDrink.GetAsString()} a while ago");
Talk($"The Devolper blames Gottfried for bringing {drinkType.GetAsString()} but he actaully wanted a {_wantedDrink.GetAsString()}");
_happiness -= 0.2;
}
}
@ -248,8 +217,7 @@ public class Developer : MonoBehaviour
_needList.Remove(_hungerNeed);
NeedFullfilled(_hungerNeed);
_hungerNeed = null;
Talk("The Developer thanks Gottfried for the Pizza", 1);
_privateContextBuffer.Add($"The Developer is greatful for the Pizza Gottfried brought him a while ago");
Talk("The Developer thanks Gottfried for the Pizza");
}
if (_wantedFood != WantedConsumable.None)
@ -282,8 +250,7 @@ public class Developer : MonoBehaviour
_needList.Remove(_toiletNeed);
NeedFullfilled(_toiletNeed);
_toiletNeed = null;
Talk("The Developer finally can go to the toilet", 1);
_privateContextBuffer.Add($"The developer is grateful that he went to the toilet a while ago");
Talk("The Developer finally can go to the toilet");
}
if (onToilet)
@ -345,8 +312,6 @@ public class Developer : MonoBehaviour
if (_hungerLevel <= 0.0)
{
if (!_isDead)
Talk($"The developer is starving, The developer is dying, The developer blames Gottfried for letting him starve with his last words", 0, true);
Die();
}
}
@ -386,32 +351,18 @@ public class Developer : MonoBehaviour
private double CalculateCaffeineEfficiency()
{
if (_isSleeping)
{
if (!_hasTalkedBeforeSleeping)
{
Talk("The Developer is very sleepy right now duo to a lack of caffeine, The Developer takes a nap now", 0, true);
_privateContextBuffer.Add($"The developer took a refreshing nap but is annoyed that Gottfried forgot to bring him any caffeine before the nap");
_hasTalkedBeforeSleeping = true;
}
return 0.0;
}
else
{
_hasTalkedBeforeSleeping = false;
}
if (_isHyperactive)
{
if (!_hasTalkedWhileHyperactive)
{
GetComponent<Text2Speech>().speakingSpeed = 1.4f;
Talk("The Developer is surprisingly productive right now and feels an energyboost duo to caffeine", 0, true);
Talk("The Developer is surprisingly productive right now duo to caffeine");
_hasTalkedWhileHyperactive = true;
}
}
else
{
GetComponent<Text2Speech>().speakingSpeed = 1.1f;
_hasTalkedWhileHyperactive = false;
}
@ -419,8 +370,7 @@ public class Developer : MonoBehaviour
{
if (!_hasTalkedWhileOvercaffeinated)
{
Talk("The Developer had too much caffeine, The Developer needs a break immediately", 0, true);
_privateContextBuffer.Add($"The developer overcaffeinated a while ago because Gottfried gave him too much caffeine");
Talk("The Developer drank too much caffeine, The Developer needs a break immediately");
_hasTalkedWhileOvercaffeinated = true;
}
return 0.0;
@ -467,27 +417,11 @@ public class Developer : MonoBehaviour
// Ob er stirbt oder nicht, für uns hat er auf jeden Fall seinen Nutzen verloren.
if (_fingersLeft == 0)
{
if (!_isDead)
Talk($"The developer lost all his fingers duo to an attack by a monster, The developer is dying, The developer gives a short speech with his last words, The developer blames Gottfried for his death", 0, true);
Die();
}
else
{
if (_fingersLeft == 9)
Talk($"The developer lost a finger duo to an attack by a monster, The developer has {_fingersLeft} left, The developer is in pain, The developer is irrevocably less productive now, The developer blames Gottfried for this", 0, true);
else
Talk($"The developer lost another finger duo to an attack by a monster, The developer has only {_fingersLeft} left, The developer is in pain, The developer is irrevocably less productive now, The developer blames Gottfried for this", 0, true);
if (Random.Range(0, 3) < 2)
_privateContextBuffer.Add($"The developer cries for his {10 - _fingersLeft} lost fingers");
else
_privateContextBuffer.Add($"The developer is greatful he still has {_fingersLeft} fingers even tho he had 10 once");
}
}
private void Die()
{
_isDead = true;
Debug.Log($"{Name} ist verreckt.");
}
@ -497,50 +431,29 @@ public class Developer : MonoBehaviour
return distanceToPlayer <= _talkRange;
}
/// <summary>
/// Returns the context stored in the contextBuffer seperated with ',' as a string
/// </summary>
/// <returns></returns>
public string GetPrivateContextAsString()
{
if (_privateContextBuffer.Count != 0)
{
string output = "";
foreach (string context in _privateContextBuffer)
{
output += context + ", ";
}
return output;
}
return string.Empty;
}
/// <summary>
/// Starts talking when player is near to the Dev.
/// </summary>
public void TalkIfInRange()
{
if (IsGottfriedInRange() && !_isDead && !_isSleeping)
if (IsGottfriedInRange())
{
string context = GetPrivateContextAsString();
context += GameManager.Instance.GetContextAsString();
Talk(context);
Talk();
}
}
/// <summary>
/// Dev starts talking.
/// </summary>
public void Talk(string context, int shortnessLevel = 0, bool priority = false)
public void Talk(string context = null)
{
if (priority)
if (context == null)
{
_audioSource.Stop();
_audioSource.clip = null;
context = GameManager.Instance.GetContextAsString();
}
if (!_audioSource.isPlaying)
{
GetComponent<Text2Speech>().Generate(context, shortnessLevel);
GetComponent<Text2Speech>().Generate(context);
}
}
}

View File

@ -41,11 +41,11 @@ public class DeveloperNeeds : MonoBehaviour
{
case "coffee":
spawnedNeed = Instantiate(Needs[0], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), Needs[0].transform.rotation);
context = "The Developer wants Gottfried to bring him a coffee";
context = "The Developer wants coffee";
break;
case "mate":
spawnedNeed = Instantiate(Needs[1], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), Needs[0].transform.rotation);
context = "The Developer wants Gottfried to bring him a Blub Mate (Yes, its a drink called Blub Mate)";
context = "The Developer wants a Blub Mate (Yes, its a drink called Blub Mate)";
break;
case "toilet":
spawnedNeed = Instantiate(Needs[2], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), Needs[0].transform.rotation);
@ -53,11 +53,7 @@ public class DeveloperNeeds : MonoBehaviour
break;
case "hunger":
spawnedNeed = Instantiate(Needs[3], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), Needs[0].transform.rotation);
context = "The Developer wants Gottfried to bring him a pizza";
break;
case "money":
spawnedNeed = Instantiate(Needs[3], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), Needs[0].transform.rotation);
context = "The Developer wants a raise, The Developer needs more money";
context = "The Developer wants a pizza";
break;
default:
Debug.LogError($"Unbekannter need \"{needName}\"");
@ -70,7 +66,7 @@ public class DeveloperNeeds : MonoBehaviour
spawnedNeed.transform.localScale = new Vector3(0.4f, 0.01f, 0.4f);
if (!_audioSource.isPlaying)
{
_text2speech.Generate(context, 1);
_text2speech.Generate(context);
}
return spawnedNeed;
}

View File

@ -41,7 +41,7 @@ public partial class GameManager : MonoBehaviourSingleton<GameManager>
private DifficultySettings _difficultySettings;
[SerializeField]
private int _maxContextBufferSize = 3;
private int _maxContextBufferSize = 5;
[SerializeField]
private CircularBuffer<string> _contextBuffer;
@ -91,8 +91,6 @@ public partial class GameManager : MonoBehaviourSingleton<GameManager>
TimeManager.Instance.Init();
_contextBuffer = new CircularBuffer<string>(_maxContextBufferSize);
_contextBuffer.Add("The Developer is greatful to work at this office with Gottfried");
_contextBuffer.Add("The Developer excited to develope the new game");
_difficultySettings = _difficulty.GetSettings();
@ -207,7 +205,7 @@ public partial class GameManager : MonoBehaviourSingleton<GameManager>
}
return output;
}
return string.Empty;
return null;
}
/// <summary>
@ -218,22 +216,4 @@ public partial class GameManager : MonoBehaviourSingleton<GameManager>
{
_contextBuffer.Add(context);
}
/// <summary>
/// Removes the given string from the context
/// </summary>
/// <param name="context"></param>
public void RemoveContext(string context)
{
if ( _contextBuffer.Contains(context) )
{
List<string> contextAsList = _contextBuffer.ToArray().ToList();
_contextBuffer.Clear();
contextAsList.Remove(context);
foreach (var c in contextAsList)
{
_contextBuffer.Add(c);
}
}
}
}

View File

@ -12,7 +12,6 @@ using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using Google.Cloud.TextToSpeech.V1;
using Palmmedia.ReportGenerator.Core;
[Serializable]
public class TextToSpeechResponse
@ -36,7 +35,7 @@ public class Text2Speech : MonoBehaviour
[SerializeField]
public bool generate = false;
[SerializeField]
public bool newVoice = false;
public bool newVoiceAndGenerate = false;
[SerializeField]
public string Voice;
@ -50,10 +49,8 @@ public class Text2Speech : MonoBehaviour
private OpenAIAPI _openAiApi;
private Conversation? _conversation;
private readonly string _openAiApiKey = "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";
private readonly string _defaultPrompt = "Write a short text for a Developer as an NPC in a game. The Developer works at a small gamedevelopement office and its manager is called Gottfried who is responsable for all the Developers needs and protection. The text should be based on the following bullet-point context, which describes the events of the last moments. Remember to only respond with the short text that only this ONE Developer should speak and nothing else! The context is: ";
private readonly string _shortPrompt = "Write a relatively short text for a Developer as an NPC in a game. The Developer works at a small gamedevelopement office and its manager is called Gottfried who is responsable for all the Developers needs and protection. The text should be based on the following bullet-point context, which describes the events of the last moments. Remember to only respond with the relatively short text that only this ONE Developer should speak and nothing else! The context is: ";
private readonly string _veryShortPrompt = "Write a very short text for a Developer as an NPC in a game. The Developer works at a small gamedevelopement office and its manager is called Gottfried who is responsable for all the Developers needs and protection. The text should be based on the following bullet-point context, which describes the events of the last moments. Remember to only respond with the very short text that only this ONE Developer should speak and nothing else! The context is: ";
private int _shortnessLevel = 0;
private readonly string _prompt = "Write a short text for a Developer as an NPC in a game. The Developer works at a small gamedevelopement office and its manager is called Gottfried who is responsable for all the Developers needs. The text should be based on the following bullet-point context, which describes the events of the last moments. Remember to only respond with the short text that only this ONE Developer should speak and nothing else! The context is: ";
void Start()
{
_tmpPath = "tmp_audio_" + GetInstanceID().ToString() + ".wav";
@ -72,9 +69,9 @@ public class Text2Speech : MonoBehaviour
generate = false;
if (voice == null)
{
GetRandomEnglishVoice(gender, (v) => {
GetRandomGermanVoice(gender, (v) => {
voice = v;
Voice = voice.ToString();
Voice = voice.ToString();
//Debug.Log($"GoogleCloud: Choosen voice is\n{voice}");
StartCoroutine(GenerateAndSynthesizeText(context));
});
@ -84,27 +81,27 @@ public class Text2Speech : MonoBehaviour
StartCoroutine(GenerateAndSynthesizeText(context));
}
}
if (newVoice)
if (newVoiceAndGenerate)
{
newVoice = false;
newVoiceAndGenerate = false;
voice = null;
Voice = null;
generate = true;
}
}
public void Generate(string c, int shortnessLevel = 0)
public void Generate(string c)
{
context = c;
_shortnessLevel = shortnessLevel;
generate = true;
}
public void GetRandomEnglishVoice(string gender, Action<JToken> callback)
public void GetRandomGermanVoice(string gender, Action<JToken> callback)
{
StartCoroutine(GetRandomEnglishVoiceCoroutine(gender, callback));
StartCoroutine(GetRandomGermanVoiceCoroutine(gender, callback));
}
private IEnumerator GetRandomEnglishVoiceCoroutine(string gender, Action<JToken> callback)
private IEnumerator GetRandomGermanVoiceCoroutine(string gender, Action<JToken> callback)
{
string url = $"https://texttospeech.googleapis.com/v1beta1/voices?key={_googelCloudApiKey}";
@ -194,19 +191,7 @@ public class Text2Speech : MonoBehaviour
};
_conversation = _openAiApi.Chat.CreateConversation(chatRequest);
string prompt = _defaultPrompt;
switch (_shortnessLevel)
{
case 1:
prompt = _shortPrompt; break;
case 2:
prompt = _veryShortPrompt; break;
default:
break;
}
_conversation.AppendUserInput(prompt + context);
_conversation.AppendUserInput(_prompt + context);
string response = await _conversation.GetResponseFromChatbotAsync();
//Debug.Log($"ChatGPT: {response}");
return response;

View File

@ -40,11 +40,6 @@ public class TimeManager : MonoBehaviourSingleton<TimeManager>
/// </summary>
public DateTime Deadline => _deadline;
/// <summary>
/// Wie viele Sekunden ein Tag im Spiel hat
/// </summary>
public double SecondsPerDay => _secondsPerDay;
/// <summary>
/// Gibt true zurück, wenn die Deadline verpasst wurde.
/// </summary>

View File

@ -8,32 +8,3 @@
"pitch": -2
}
{
"languageCodes": [
"en-US"
],
"name": "en-US-Studio-Q",
"ssmlGender": "MALE",
"naturalSampleRateHertz": 24000,
"pitch": 1
}
{
"languageCodes": [
"en-AU"
],
"name": "en-AU-Wavenet-D",
"ssmlGender": "MALE",
"naturalSampleRateHertz": 24000,
"pitch": 6
}
{
"languageCodes": [
"en-AU"
],
"name": "en-AU-Neural2-D",
"ssmlGender": "MALE",
"naturalSampleRateHertz": 24000,
"pitch": 2
}

View File

@ -11,15 +11,7 @@ public class Zeitschaltuhr : MonoBehaviour, ISerializationCallbackReceiver
{
private TimeSpan _turnOnTimeSpan;
private TimeSpan _turnOffTimeSpan;
private float _activeTimeSpanInSeconds;
/// <summary>
/// Die Dauer der Active-Time der Kinder in echten Sekunden
/// </summary>
public float ActiveTimeSpanInSeconds => _activeTimeSpanInSeconds;
/// <summary>
/// Ob die Kinder gerade aktiv sind oder nicht
/// </summary>
public bool IsOn;
[SerializeField] private SimpleTime _turnOnTime;
@ -47,7 +39,6 @@ public class Zeitschaltuhr : MonoBehaviour, ISerializationCallbackReceiver
void Start()
{
CalculateOnTimeInSeconds();
UpdateOn();
}
@ -103,23 +94,4 @@ public class Zeitschaltuhr : MonoBehaviour, ISerializationCallbackReceiver
_turnOnTimeSpan = _turnOnTime.ToTimeSpan();
_turnOffTimeSpan = _turnOffTime.ToTimeSpan();
}
private void CalculateOnTimeInSeconds()
{
TimeSpan turnOnTimeSpan = _turnOnTime.ToTimeSpan();
TimeSpan turnOffTimeSpan = _turnOffTime.ToTimeSpan();
float onDurationInSeconds;
if (turnOnTimeSpan < turnOffTimeSpan)
{
onDurationInSeconds = (float)(turnOffTimeSpan - turnOnTimeSpan).TotalSeconds;
}
else
{
TimeSpan fullDay = TimeSpan.FromHours(24);
onDurationInSeconds = (float)((fullDay - turnOnTimeSpan) + turnOffTimeSpan).TotalSeconds;
}
_activeTimeSpanInSeconds = onDurationInSeconds * ((float)TimeManager.Instance.SecondsPerDay / 86400f); // 86400 Sekunden pro Tag
}
}

View File

@ -8,17 +8,14 @@ public class ZombieSpawner : MonoBehaviour
[SerializeField]
GameObject ZombiePrefab;
[SerializeField]
private float _spawnRate = 2.0f;
private float _spawnRate = 1.0f;
[SerializeField, ShowOnly]
private float _spawnTimer;
private float _secondsPerAliveTime;
// Start wird aufgerufen, bevor das erste Frame gezeichnet wird
void Start()
{
_secondsPerAliveTime = GetComponentInParent<Zeitschaltuhr>().ActiveTimeSpanInSeconds;
_spawnTimer = Random.Range(0.5f * _secondsPerAliveTime / _spawnRate, _secondsPerAliveTime / _spawnRate);
_spawnTimer = 60 / _spawnRate;
}
// Update wird einmal pro Frame aufgerufen
@ -28,33 +25,8 @@ public class ZombieSpawner : MonoBehaviour
if (_spawnTimer <= 0)
{
Instantiate(ZombiePrefab, transform.position, Quaternion.identity, transform);
_spawnTimer = _secondsPerAliveTime / _spawnRate;
Instantiate(ZombiePrefab, transform.position, Quaternion.identity);
_spawnTimer = 60 / _spawnRate;
}
}
private void OnEnable()
{
if (GameManager.Instance != null)
{
if (GameManager.Instance.ContextBuffer != null)
GameManager.Instance.AddContext("The Developer informs Gottfried that Zombies appeared outside so Gottfried better not leave the office");
}
}
private void OnDisable()
{
if (GameManager.Instance.ContextBuffer != null)
GameManager.Instance.RemoveContext("The Developer informs Gottfried that Zombies appeared outside so Gottfried better not leave the office");
// Destroy all children (zombies)
for (int i = 0; i < transform.childCount; i++)
{
KillZombiesByDisable();
}
}
private void KillZombiesByDisable()
{
Destroy(transform.GetChild(i).gameObject);
}
}