Zombies machen mehr geräsche und andere tolle sachen und laufen zum spieler
This commit is contained in:
parent
51f9151060
commit
b378c4e834
|
@ -74,6 +74,9 @@ GameObject:
|
||||||
- component: {fileID: 856601670117272814}
|
- component: {fileID: 856601670117272814}
|
||||||
- component: {fileID: 856601670124978856}
|
- component: {fileID: 856601670124978856}
|
||||||
- component: {fileID: -8235577483402533963}
|
- component: {fileID: -8235577483402533963}
|
||||||
|
- component: {fileID: 7592819367808213806}
|
||||||
|
- component: {fileID: -7820506418288782251}
|
||||||
|
- component: {fileID: -445327316813513434}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Zombie
|
m_Name: Zombie
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -131,6 +134,159 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: a455fc831fa3efb449326d693b740682, type: 3}
|
m_Script: {fileID: 11500000, guid: a455fc831fa3efb449326d693b740682, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
Noises:
|
||||||
|
- {fileID: 8300000, guid: 866ac9f78eeaf514aa666667753ff280, type: 3}
|
||||||
|
- {fileID: 8300000, guid: daa3c8aa3194de542ab4aa911886644b, type: 3}
|
||||||
|
- {fileID: 8300000, guid: 559ec60d7a147d14dbbfc776266dad5e, type: 3}
|
||||||
|
speed: 3
|
||||||
|
_noiseDelay: 5
|
||||||
|
_noiseTimer: 0
|
||||||
|
--- !u!54 &7592819367808213806
|
||||||
|
Rigidbody:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 856601670117699726}
|
||||||
|
serializedVersion: 4
|
||||||
|
m_Mass: 1
|
||||||
|
m_Drag: 0
|
||||||
|
m_AngularDrag: 0.05
|
||||||
|
m_CenterOfMass: {x: 0, y: 0, z: 0}
|
||||||
|
m_InertiaTensor: {x: 1, y: 1, z: 1}
|
||||||
|
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ImplicitCom: 1
|
||||||
|
m_ImplicitTensor: 1
|
||||||
|
m_UseGravity: 0
|
||||||
|
m_IsKinematic: 0
|
||||||
|
m_Interpolate: 0
|
||||||
|
m_Constraints: 80
|
||||||
|
m_CollisionDetection: 0
|
||||||
|
--- !u!136 &-7820506418288782251
|
||||||
|
CapsuleCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 856601670117699726}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_LayerOverridePriority: 0
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_ProvidesContacts: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Radius: 0.31
|
||||||
|
m_Height: 1.54
|
||||||
|
m_Direction: 1
|
||||||
|
m_Center: {x: 0, y: 0.79, z: 0}
|
||||||
|
--- !u!82 &-445327316813513434
|
||||||
|
AudioSource:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 856601670117699726}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 4
|
||||||
|
OutputAudioMixerGroup: {fileID: 0}
|
||||||
|
m_audioClip: {fileID: 0}
|
||||||
|
m_PlayOnAwake: 1
|
||||||
|
m_Volume: 1
|
||||||
|
m_Pitch: 1
|
||||||
|
Loop: 0
|
||||||
|
Mute: 0
|
||||||
|
Spatialize: 0
|
||||||
|
SpatializePostEffects: 0
|
||||||
|
Priority: 128
|
||||||
|
DopplerLevel: 1
|
||||||
|
MinDistance: 1
|
||||||
|
MaxDistance: 500
|
||||||
|
Pan2D: 0
|
||||||
|
rolloffMode: 0
|
||||||
|
BypassEffects: 0
|
||||||
|
BypassListenerEffects: 0
|
||||||
|
BypassReverbZones: 0
|
||||||
|
rolloffCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 1
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 1
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
panLevelCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
spreadCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
reverbZoneMixCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 1
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
--- !u!1 &856601670117699840
|
--- !u!1 &856601670117699840
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -1405,11 +1405,6 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: f7e417f330c4dd845a8f3dc744dff25a, type: 3}
|
m_Script: {fileID: 11500000, guid: f7e417f330c4dd845a8f3dc744dff25a, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
Needs:
|
|
||||||
- {fileID: 2907046783514947559, guid: 92b71cfc6a2687d44b165ead746233f0, type: 3}
|
|
||||||
- {fileID: 3355435593704932208, guid: b31fb59d198e53b459943bf898293618, type: 3}
|
|
||||||
- {fileID: 7697340910557049827, guid: 5d809e3a343d45f4185615db92384dc7, type: 3}
|
|
||||||
- {fileID: 2405502523364773131, guid: b396df2098c22e1488c2c2769c6ddcd6, type: 3}
|
|
||||||
--- !u!82 &983523623
|
--- !u!82 &983523623
|
||||||
AudioSource:
|
AudioSource:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -1964,6 +1959,26 @@ PrefabInstance:
|
||||||
propertyPath: _player
|
propertyPath: _player
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 514859711}
|
objectReference: {fileID: 514859711}
|
||||||
|
- target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: Needs.Array.size
|
||||||
|
value: 4
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: Needs.Array.data[0]
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 2907046783514947559, guid: 92b71cfc6a2687d44b165ead746233f0, type: 3}
|
||||||
|
- target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: Needs.Array.data[1]
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 3355435593704932208, guid: b31fb59d198e53b459943bf898293618, type: 3}
|
||||||
|
- target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: Needs.Array.data[2]
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 7697340910557049827, guid: 5d809e3a343d45f4185615db92384dc7, type: 3}
|
||||||
|
- target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
|
propertyPath: Needs.Array.data[3]
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 2350437210533342175, guid: 2122156ae265fcc4da01213f31a64901, type: 3}
|
||||||
- target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
- target: {fileID: 3650884189301972455, guid: e1e33f0b2075b5c40817665dd8a86f31, type: 3}
|
||||||
propertyPath: _maxContextBufferSize
|
propertyPath: _maxContextBufferSize
|
||||||
value: 3
|
value: 3
|
||||||
|
@ -2217,11 +2232,6 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: f7e417f330c4dd845a8f3dc744dff25a, type: 3}
|
m_Script: {fileID: 11500000, guid: f7e417f330c4dd845a8f3dc744dff25a, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
Needs:
|
|
||||||
- {fileID: 2907046783514947559, guid: 92b71cfc6a2687d44b165ead746233f0, type: 3}
|
|
||||||
- {fileID: 3355435593704932208, guid: b31fb59d198e53b459943bf898293618, type: 3}
|
|
||||||
- {fileID: 7697340910557049827, guid: 5d809e3a343d45f4185615db92384dc7, type: 3}
|
|
||||||
- {fileID: 2350437210533342175, guid: 2122156ae265fcc4da01213f31a64901, type: 3}
|
|
||||||
--- !u!114 &1814492794
|
--- !u!114 &1814492794
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5ff33cd0eb0cb134f9f8e973ef464fbb
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -404,14 +404,13 @@ public class Developer : MonoBehaviour
|
||||||
{
|
{
|
||||||
if (!_hasTalkedWhileHyperactive)
|
if (!_hasTalkedWhileHyperactive)
|
||||||
{
|
{
|
||||||
GetComponent<Text2Speech>().speakingSpeed = 1.4f;
|
GetComponent<Text2Speech>().speakingSpeed = 1.3f;
|
||||||
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 and feels an energyboost duo to caffeine", 0, true);
|
||||||
_hasTalkedWhileHyperactive = true;
|
_hasTalkedWhileHyperactive = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetComponent<Text2Speech>().speakingSpeed = 1.1f;
|
|
||||||
_hasTalkedWhileHyperactive = false;
|
_hasTalkedWhileHyperactive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,6 +418,7 @@ public class Developer : MonoBehaviour
|
||||||
{
|
{
|
||||||
if (!_hasTalkedWhileOvercaffeinated)
|
if (!_hasTalkedWhileOvercaffeinated)
|
||||||
{
|
{
|
||||||
|
GetComponent<Text2Speech>().speakingSpeed = 1.4f;
|
||||||
Talk("The Developer had too much caffeine, The Developer needs a break immediately", 0, true);
|
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");
|
_privateContextBuffer.Add($"The developer overcaffeinated a while ago because Gottfried gave him too much caffeine");
|
||||||
_hasTalkedWhileOvercaffeinated = true;
|
_hasTalkedWhileOvercaffeinated = true;
|
||||||
|
@ -430,6 +430,9 @@ public class Developer : MonoBehaviour
|
||||||
_hasTalkedWhileOvercaffeinated = false;
|
_hasTalkedWhileOvercaffeinated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_isHyperactive && !_isOvercaffeinated)
|
||||||
|
GetComponent<Text2Speech>().speakingSpeed = 1.1f;
|
||||||
|
|
||||||
// https://easings.net/#easeOutCubic
|
// https://easings.net/#easeOutCubic
|
||||||
return 1.0 - Math.Pow(1.0 - _caffeineLevel, 3.0);
|
return 1.0 - Math.Pow(1.0 - _caffeineLevel, 3.0);
|
||||||
}
|
}
|
||||||
|
@ -520,7 +523,7 @@ public class Developer : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void TalkIfInRange()
|
public void TalkIfInRange()
|
||||||
{
|
{
|
||||||
if (IsGottfriedInRange() && !_isDead && !_isSleeping)
|
if (IsGottfriedInRange() && !_isDead && !_isSleeping && (_needList.Count == 0))
|
||||||
{
|
{
|
||||||
string context = GetPrivateContextAsString();
|
string context = GetPrivateContextAsString();
|
||||||
context += GameManager.Instance.GetContextAsString();
|
context += GameManager.Instance.GetContextAsString();
|
||||||
|
|
|
@ -4,8 +4,6 @@ using UnityEngine;
|
||||||
|
|
||||||
public class DeveloperNeeds : MonoBehaviour
|
public class DeveloperNeeds : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] List<GameObject> Needs = new List<GameObject>();
|
|
||||||
|
|
||||||
private Text2Speech _text2speech;
|
private Text2Speech _text2speech;
|
||||||
private AudioSource _audioSource;
|
private AudioSource _audioSource;
|
||||||
|
|
||||||
|
@ -40,23 +38,23 @@ public class DeveloperNeeds : MonoBehaviour
|
||||||
switch (needName)
|
switch (needName)
|
||||||
{
|
{
|
||||||
case "coffee":
|
case "coffee":
|
||||||
spawnedNeed = Instantiate(Needs[0], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), Needs[0].transform.rotation);
|
spawnedNeed = Instantiate(GameManager.Instance.Needs[0], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), GameManager.Instance.Needs[0].transform.rotation);
|
||||||
context = "The Developer wants Gottfried to bring him a coffee";
|
context = "The Developer wants Gottfried to bring him a coffee";
|
||||||
break;
|
break;
|
||||||
case "mate":
|
case "mate":
|
||||||
spawnedNeed = Instantiate(Needs[1], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), Needs[0].transform.rotation);
|
spawnedNeed = Instantiate(GameManager.Instance.Needs[1], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), GameManager.Instance.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 Gottfried to bring him a Blub Mate (Yes, its a drink called Blub Mate)";
|
||||||
break;
|
break;
|
||||||
case "toilet":
|
case "toilet":
|
||||||
spawnedNeed = Instantiate(Needs[2], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), Needs[0].transform.rotation);
|
spawnedNeed = Instantiate(GameManager.Instance.Needs[2], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), GameManager.Instance.Needs[0].transform.rotation);
|
||||||
context = "The Developer wants to go to the toilet";
|
context = "The Developer wants to go to the toilet";
|
||||||
break;
|
break;
|
||||||
case "hunger":
|
case "hunger":
|
||||||
spawnedNeed = Instantiate(Needs[3], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), Needs[0].transform.rotation);
|
spawnedNeed = Instantiate(GameManager.Instance.Needs[3], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), GameManager.Instance.Needs[0].transform.rotation);
|
||||||
context = "The Developer wants Gottfried to bring him a pizza";
|
context = "The Developer wants Gottfried to bring him a pizza";
|
||||||
break;
|
break;
|
||||||
case "money":
|
case "money":
|
||||||
spawnedNeed = Instantiate(Needs[3], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), Needs[0].transform.rotation);
|
spawnedNeed = Instantiate(GameManager.Instance.Needs[3], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), GameManager.Instance.Needs[0].transform.rotation);
|
||||||
context = "The Developer wants a raise, The Developer needs more money";
|
context = "The Developer wants a raise, The Developer needs more money";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -13,6 +13,8 @@ public partial class GameManager : MonoBehaviourSingleton<GameManager>
|
||||||
|
|
||||||
public GameObject NeedFullfilledParticleEffect;
|
public GameObject NeedFullfilledParticleEffect;
|
||||||
public GameObject ZombieDeathByDisableParticleEffect;
|
public GameObject ZombieDeathByDisableParticleEffect;
|
||||||
|
[SerializeField]
|
||||||
|
public List<GameObject> Needs = new List<GameObject>();
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Character _player;
|
private Character _player;
|
||||||
|
|
|
@ -54,6 +54,7 @@ public class Text2Speech : MonoBehaviour
|
||||||
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 _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 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 int _shortnessLevel = 0;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
_tmpPath = "tmp_audio_" + GetInstanceID().ToString() + ".wav";
|
_tmpPath = "tmp_audio_" + GetInstanceID().ToString() + ".wav";
|
||||||
|
@ -166,7 +167,7 @@ public class Text2Speech : MonoBehaviour
|
||||||
|
|
||||||
IEnumerator GenerateAndSynthesizeText(string context)
|
IEnumerator GenerateAndSynthesizeText(string context)
|
||||||
{
|
{
|
||||||
var generateTextTask = GenerateTextAsync(context);
|
var generateTextTask = GenerateText(context);
|
||||||
|
|
||||||
yield return new WaitUntil(() => generateTextTask.IsCompleted);
|
yield return new WaitUntil(() => generateTextTask.IsCompleted);
|
||||||
|
|
||||||
|
@ -181,7 +182,7 @@ public class Text2Speech : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<string> GenerateTextAsync(string context)
|
async Task<string> GenerateText(string context)
|
||||||
{
|
{
|
||||||
Model model = Model.ChatGPTTurbo;
|
Model model = Model.ChatGPTTurbo;
|
||||||
|
|
||||||
|
|
|
@ -2,17 +2,78 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
using Utility;
|
||||||
|
|
||||||
public class Zombie : MonoBehaviour
|
public class Zombie : MonoBehaviour
|
||||||
{
|
{
|
||||||
// Start is called before the first frame update
|
[SerializeField]
|
||||||
|
List<AudioClip> Noises;
|
||||||
|
[SerializeField]
|
||||||
|
public float speed = 5f;
|
||||||
|
[SerializeField]
|
||||||
|
private float _noiseDelay = 5.0f;
|
||||||
|
[SerializeField, ShowOnly]
|
||||||
|
private float _noiseTimer;
|
||||||
|
|
||||||
|
private Rigidbody _rb;
|
||||||
|
private AudioSource _audioSource;
|
||||||
|
private bool _fadeOutNoise = false;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
_rb = GetComponent<Rigidbody>();
|
||||||
|
_noiseTimer = Random.Range(0.3f * _noiseDelay, 1.5f * _noiseDelay);
|
||||||
|
_audioSource = GetComponent<AudioSource>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
UpdateNoise();
|
||||||
|
MoveTowardsPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MoveTowardsPlayer()
|
||||||
|
{
|
||||||
|
Vector3 direction = (GameManager.Instance.Player.transform.position - transform.position).normalized;
|
||||||
|
_rb.MovePosition(_rb.position + direction * speed * Time.deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateNoise()
|
||||||
|
{
|
||||||
|
if (!_fadeOutNoise)
|
||||||
|
{
|
||||||
|
_noiseTimer -= Time.deltaTime;
|
||||||
|
|
||||||
|
if (_noiseTimer < 0)
|
||||||
|
{
|
||||||
|
_noiseTimer = _noiseDelay;
|
||||||
|
PlayRandomNoise();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_audioSource.volume -= _audioSource.volume * Time.deltaTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PlayRandomNoise()
|
||||||
|
{
|
||||||
|
if (!_audioSource.isPlaying)
|
||||||
|
{
|
||||||
|
_audioSource.clip = Noises[Random.Range(0, Noises.Count)];
|
||||||
|
_audioSource.Play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void FadeOutNoise()
|
||||||
|
{
|
||||||
|
_fadeOutNoise = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,32 +13,52 @@ public class ZombieSpawner : MonoBehaviour
|
||||||
GameObject ZombiePrefab;
|
GameObject ZombiePrefab;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private float _spawnRate = 2.0f;
|
private float _spawnRate = 2.0f;
|
||||||
|
[SerializeField]
|
||||||
|
private float _dontSpawnForLastSeconds = 3.0f;
|
||||||
[SerializeField, ShowOnly]
|
[SerializeField, ShowOnly]
|
||||||
private float _spawnTimer;
|
private float _spawnTimer;
|
||||||
|
[SerializeField, ShowOnly]
|
||||||
|
private float _enabledTimer = 0.0f;
|
||||||
|
|
||||||
private float _secondsPerAliveTime;
|
private float _secondsPerAliveTime;
|
||||||
|
private bool _startedFading = false;
|
||||||
|
|
||||||
// Start wird aufgerufen, bevor das erste Frame gezeichnet wird
|
// Start wird aufgerufen, bevor das erste Frame gezeichnet wird
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
_secondsPerAliveTime = GetComponentInParent<Zeitschaltuhr>().ActiveTimeSpanInSeconds;
|
// letzte _dontSpawnForLastSeconds sekunden keine Zombies mehr spawnen
|
||||||
|
_secondsPerAliveTime = GetComponentInParent<Zeitschaltuhr>().ActiveTimeSpanInSeconds - _dontSpawnForLastSeconds;
|
||||||
_spawnTimer = Random.Range(0.5f * _secondsPerAliveTime / _spawnRate, _secondsPerAliveTime / _spawnRate);
|
_spawnTimer = Random.Range(0.5f * _secondsPerAliveTime / _spawnRate, _secondsPerAliveTime / _spawnRate);
|
||||||
|
_enabledTimer = _secondsPerAliveTime + _dontSpawnForLastSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update wird einmal pro Frame aufgerufen
|
// Update wird einmal pro Frame aufgerufen
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
_enabledTimer -= Time.deltaTime;
|
||||||
_spawnTimer -= Time.deltaTime;
|
_spawnTimer -= Time.deltaTime;
|
||||||
|
|
||||||
|
// als übergang von Schrei zu Tröte
|
||||||
|
if (_enabledTimer < _dontSpawnForLastSeconds && !_startedFading)
|
||||||
|
{
|
||||||
|
_startedFading = true;
|
||||||
|
FadeOutNoises();
|
||||||
|
}
|
||||||
|
|
||||||
if (_spawnTimer <= 0)
|
if (_spawnTimer <= 0)
|
||||||
{
|
{
|
||||||
SpawnZombie();
|
SpawnZombie();
|
||||||
_spawnTimer = _secondsPerAliveTime / _spawnRate;
|
_spawnTimer = (_secondsPerAliveTime - _dontSpawnForLastSeconds) / _spawnRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
|
if (_secondsPerAliveTime > 0)
|
||||||
|
{
|
||||||
|
_enabledTimer = _secondsPerAliveTime;
|
||||||
|
_startedFading = false;
|
||||||
|
}
|
||||||
if (GameManager.Instance != null)
|
if (GameManager.Instance != null)
|
||||||
{
|
{
|
||||||
if (GameManager.Instance.ContextBuffer != null)
|
if (GameManager.Instance.ContextBuffer != null)
|
||||||
|
@ -55,8 +75,18 @@ public class ZombieSpawner : MonoBehaviour
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FadeOutNoises()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < transform.childCount; i++)
|
||||||
|
{
|
||||||
|
GameObject zombie = transform.GetChild(i).gameObject;
|
||||||
|
zombie.GetComponent<Zombie>().FadeOutNoise();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void SpawnZombie()
|
private void SpawnZombie()
|
||||||
{
|
{
|
||||||
|
if (transform.childCount > _spawnRate) return;
|
||||||
Transform pos = SpawnPoints[Random.Range(0, SpawnPoints.Count)];
|
Transform pos = SpawnPoints[Random.Range(0, SpawnPoints.Count)];
|
||||||
Instantiate(ZombiePrefab, pos.position, Quaternion.identity, transform);
|
Instantiate(ZombiePrefab, pos.position, Quaternion.identity, transform);
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,23 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 866ac9f78eeaf514aa666667753ff280
|
||||||
|
AudioImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 7
|
||||||
|
defaultSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
loadType: 0
|
||||||
|
sampleRateSetting: 0
|
||||||
|
sampleRateOverride: 44100
|
||||||
|
compressionFormat: 1
|
||||||
|
quality: 1
|
||||||
|
conversionMode: 0
|
||||||
|
preloadAudioData: 0
|
||||||
|
platformSettingOverrides: {}
|
||||||
|
forceToMono: 0
|
||||||
|
normalize: 1
|
||||||
|
loadInBackground: 0
|
||||||
|
ambisonic: 0
|
||||||
|
3D: 1
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Binary file not shown.
|
@ -0,0 +1,23 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: daa3c8aa3194de542ab4aa911886644b
|
||||||
|
AudioImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 7
|
||||||
|
defaultSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
loadType: 0
|
||||||
|
sampleRateSetting: 0
|
||||||
|
sampleRateOverride: 44100
|
||||||
|
compressionFormat: 1
|
||||||
|
quality: 1
|
||||||
|
conversionMode: 0
|
||||||
|
preloadAudioData: 0
|
||||||
|
platformSettingOverrides: {}
|
||||||
|
forceToMono: 0
|
||||||
|
normalize: 1
|
||||||
|
loadInBackground: 0
|
||||||
|
ambisonic: 0
|
||||||
|
3D: 1
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Binary file not shown.
|
@ -0,0 +1,23 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 559ec60d7a147d14dbbfc776266dad5e
|
||||||
|
AudioImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 7
|
||||||
|
defaultSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
loadType: 0
|
||||||
|
sampleRateSetting: 0
|
||||||
|
sampleRateOverride: 44100
|
||||||
|
compressionFormat: 1
|
||||||
|
quality: 1
|
||||||
|
conversionMode: 0
|
||||||
|
preloadAudioData: 0
|
||||||
|
platformSettingOverrides: {}
|
||||||
|
forceToMono: 0
|
||||||
|
normalize: 1
|
||||||
|
loadInBackground: 0
|
||||||
|
ambisonic: 0
|
||||||
|
3D: 1
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue