jetzt richtig
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<string> needs = new List<string>() { "coffee", "mate", "toilet", "money" };
|
||||
_developerNeeds.spawnNeed(needs[UnityEngine.Random.Range(0, 3)]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -220,7 +220,6 @@ public class Text2Speech : MonoBehaviour
|
||||
File.WriteAllBytes(tempFilePath, audioBytes);
|
||||
|
||||
StartCoroutine(LoadWavAudio(tempFilePath));
|
||||
SaveAudioFile(base64AudioContent);
|
||||
}
|
||||
|
||||
IEnumerator LoadWavAudio(string path)
|
||||
|
||||
Reference in New Issue
Block a user