From 39034193c13337c317dd2c68e4c57113f7b34e50 Mon Sep 17 00:00:00 2001 From: klappstuhl24 Date: Fri, 5 Apr 2024 14:34:32 +0200 Subject: [PATCH] jetzt richtig --- .../Assets/Prefabs/CoffeeDeveloperNeeds.prefab | 4 ++-- .../Assets/Prefabs/MateDeveloperNeeds.prefab | 4 ++-- .../Assets/Prefabs/MoneyDeveloperNeeds.prefab | 4 ++-- 3d Prototyp/Assets/Prefabs/NPC.prefab | 3 +-- .../Assets/Prefabs/ToiletDeveloperNeeds.prefab | 4 ++-- 3d Prototyp/Assets/Scenes/NPC_Test.unity | 4 ++++ 3d Prototyp/Assets/Scripts/DeveloperNeeds.cs | 16 ++++++++++++---- 3d Prototyp/Assets/Scripts/NPC_Behavior.cs | 7 +++++-- 3d Prototyp/Assets/Scripts/Text2Speech.cs | 1 - 9 files changed, 30 insertions(+), 17 deletions(-) diff --git a/3d Prototyp/Assets/Prefabs/CoffeeDeveloperNeeds.prefab b/3d Prototyp/Assets/Prefabs/CoffeeDeveloperNeeds.prefab index b9144e49..a6b63b80 100644 --- a/3d Prototyp/Assets/Prefabs/CoffeeDeveloperNeeds.prefab +++ b/3d Prototyp/Assets/Prefabs/CoffeeDeveloperNeeds.prefab @@ -29,8 +29,8 @@ Transform: m_GameObject: {fileID: 2907046783514947559} serializedVersion: 2 m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} - m_LocalPosition: {x: 16.851439, y: 4.76935, z: -2.999632} - m_LocalScale: {x: 0.5, y: 0.05, z: 0.5} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.6, y: 0.05, z: 0.6} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} diff --git a/3d Prototyp/Assets/Prefabs/MateDeveloperNeeds.prefab b/3d Prototyp/Assets/Prefabs/MateDeveloperNeeds.prefab index 413a5ffb..134a9696 100644 --- a/3d Prototyp/Assets/Prefabs/MateDeveloperNeeds.prefab +++ b/3d Prototyp/Assets/Prefabs/MateDeveloperNeeds.prefab @@ -29,8 +29,8 @@ Transform: m_GameObject: {fileID: 3355435593704932208} serializedVersion: 2 m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} - m_LocalPosition: {x: 16.851439, y: 4.76935, z: -2.999632} - m_LocalScale: {x: 0.5, y: 0.05, z: 0.5} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.6, y: 0.05, z: 0.6} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} diff --git a/3d Prototyp/Assets/Prefabs/MoneyDeveloperNeeds.prefab b/3d Prototyp/Assets/Prefabs/MoneyDeveloperNeeds.prefab index d0e067d2..d52db351 100644 --- a/3d Prototyp/Assets/Prefabs/MoneyDeveloperNeeds.prefab +++ b/3d Prototyp/Assets/Prefabs/MoneyDeveloperNeeds.prefab @@ -29,8 +29,8 @@ Transform: m_GameObject: {fileID: 2405502523364773131} serializedVersion: 2 m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} - m_LocalPosition: {x: 16.851439, y: 4.76935, z: -2.999632} - m_LocalScale: {x: 0.5, y: 0.05, z: 0.5} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.6, y: 0.05, z: 0.6} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} diff --git a/3d Prototyp/Assets/Prefabs/NPC.prefab b/3d Prototyp/Assets/Prefabs/NPC.prefab index 4a2dc786..eb321d91 100644 --- a/3d Prototyp/Assets/Prefabs/NPC.prefab +++ b/3d Prototyp/Assets/Prefabs/NPC.prefab @@ -251,7 +251,7 @@ MonoBehaviour: gender: FEMALE speakingSpeed: 1.1 playSound: 0 - generate: 1 + generate: 0 --- !u!114 &913419294231391695 MonoBehaviour: m_ObjectHideFlags: 0 @@ -270,7 +270,6 @@ MonoBehaviour: _baseDevelopementPower: 100 _developementPower: 100 eventRate: 1 - _gameManager: {fileID: 0} --- !u!114 &5010841683893516359 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/3d Prototyp/Assets/Prefabs/ToiletDeveloperNeeds.prefab b/3d Prototyp/Assets/Prefabs/ToiletDeveloperNeeds.prefab index cc4b4f92..28972080 100644 --- a/3d Prototyp/Assets/Prefabs/ToiletDeveloperNeeds.prefab +++ b/3d Prototyp/Assets/Prefabs/ToiletDeveloperNeeds.prefab @@ -29,8 +29,8 @@ Transform: m_GameObject: {fileID: 7697340910557049827} serializedVersion: 2 m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} - m_LocalPosition: {x: 16.851439, y: 4.76935, z: -2.999632} - m_LocalScale: {x: 0.5, y: 0.05, z: 0.5} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.6, y: 0.05, z: 0.6} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} diff --git a/3d Prototyp/Assets/Scenes/NPC_Test.unity b/3d Prototyp/Assets/Scenes/NPC_Test.unity index d2f566d0..c497712b 100644 --- a/3d Prototyp/Assets/Scenes/NPC_Test.unity +++ b/3d Prototyp/Assets/Scenes/NPC_Test.unity @@ -10069,6 +10069,10 @@ PrefabInstance: propertyPath: m_Name value: NPC objectReference: {fileID: 0} + - target: {fileID: 6061794821799343082, guid: 8c373fc5dab15cb479b5aa211e1fee34, type: 3} + propertyPath: generate + value: 0 + objectReference: {fileID: 0} - target: {fileID: 8838918674701777989, guid: 8c373fc5dab15cb479b5aa211e1fee34, type: 3} propertyPath: m_LocalPosition.x value: 15.64 diff --git a/3d Prototyp/Assets/Scripts/DeveloperNeeds.cs b/3d Prototyp/Assets/Scripts/DeveloperNeeds.cs index bc7fa81f..8ec04083 100644 --- a/3d Prototyp/Assets/Scripts/DeveloperNeeds.cs +++ b/3d Prototyp/Assets/Scripts/DeveloperNeeds.cs @@ -20,22 +20,30 @@ public class DeveloperNeeds : MonoBehaviour public void spawnNeed(string needName) { + + GameObject spawnedNeed = null; + switch (needName) { case "coffee": - Instantiate(Needs[0], new Vector3(transform.position.x, transform.position.y + 1.0f, transform.position.z), Quaternion.identity); + spawnedNeed = Instantiate(Needs[0], new Vector3(0.0f, 1.5f, 0.0f), Needs[0].transform.rotation); break; case "mate": - Instantiate(Needs[1], new Vector3(transform.position.x, transform.position.y + 1.0f, transform.position.z), Quaternion.identity); + spawnedNeed = Instantiate(Needs[1], new Vector3(0.0f, 1.5f, 0.0f), Needs[0].transform.rotation); break; case "toilet": - Instantiate(Needs[2], new Vector3(transform.position.x, transform.position.y + 1.0f, transform.position.z), Quaternion.identity); + spawnedNeed = Instantiate(Needs[2], new Vector3(0.0f, 1.5f, 0.0f), Needs[0].transform.rotation); break; case "money": - Instantiate(Needs[3], new Vector3(transform.position.x, transform.position.y + 1.0f, transform.position.z), Quaternion.identity); + spawnedNeed = Instantiate(Needs[3], new Vector3(0.0f, 1.5f, 0.0f), Needs[0].transform.rotation); break; default: break; } + + if (spawnedNeed != null) + { + spawnedNeed.transform.SetParent(transform, false); + } } } diff --git a/3d Prototyp/Assets/Scripts/NPC_Behavior.cs b/3d Prototyp/Assets/Scripts/NPC_Behavior.cs index f39e644b..6d2732f5 100644 --- a/3d Prototyp/Assets/Scripts/NPC_Behavior.cs +++ b/3d Prototyp/Assets/Scripts/NPC_Behavior.cs @@ -34,6 +34,7 @@ public class NPC_Behavior : MonoBehaviour private GameManager _gameManager; private DeveloperNeeds _developerNeeds; + private bool spawned = true; // Start is called before the first frame update void Start() @@ -46,9 +47,11 @@ public class NPC_Behavior : MonoBehaviour void Update() { // fire event - if (UnityEngine.Random.Range(0, 60) == 0) + if (spawned) { - Debug.Log("TEST"); + spawned = false; + List needs = new List() { "coffee", "mate", "toilet", "money" }; + _developerNeeds.spawnNeed(needs[UnityEngine.Random.Range(0, 3)]); } } diff --git a/3d Prototyp/Assets/Scripts/Text2Speech.cs b/3d Prototyp/Assets/Scripts/Text2Speech.cs index 4ad4e1b4..4d208ebd 100644 --- a/3d Prototyp/Assets/Scripts/Text2Speech.cs +++ b/3d Prototyp/Assets/Scripts/Text2Speech.cs @@ -220,7 +220,6 @@ public class Text2Speech : MonoBehaviour File.WriteAllBytes(tempFilePath, audioBytes); StartCoroutine(LoadWavAudio(tempFilePath)); - SaveAudioFile(base64AudioContent); } IEnumerator LoadWavAudio(string path)