2024-04-05 13:18:15 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class DeveloperNeeds : MonoBehaviour
|
|
|
|
{
|
2024-04-05 17:29:05 +02:00
|
|
|
private Text2Speech _text2speech;
|
2024-04-05 18:11:26 +02:00
|
|
|
private AudioSource _audioSource;
|
2024-04-05 17:29:05 +02:00
|
|
|
|
2024-04-05 13:18:15 +02:00
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
2024-04-05 17:29:05 +02:00
|
|
|
_text2speech = GetComponent<Text2Speech>();
|
2024-04-05 18:11:26 +02:00
|
|
|
_audioSource = GetComponent<AudioSource>();
|
2024-04-05 13:18:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2024-04-05 14:08:45 +02:00
|
|
|
|
2024-04-05 19:24:26 +02:00
|
|
|
// TODO: Enums statt strings verwenden
|
|
|
|
// TODO: Multiple Needs möglich übereinander anzeigen?
|
|
|
|
|
2024-04-06 18:30:26 +02:00
|
|
|
public GameObject SpawnCoffeeNeed(int numNeeds) => spawnNeed("coffee", numNeeds);
|
|
|
|
public GameObject SpawnMateNeed(int numNeeds) => spawnNeed("mate", numNeeds);
|
|
|
|
public GameObject SpawnToiletNeed(int numNeeds) => spawnNeed("toilet", numNeeds);
|
|
|
|
public GameObject SpawnHungerNeed(int numNeeds) => spawnNeed("hunger", numNeeds);
|
|
|
|
public GameObject SpawnMoneyNeed(int numNeeds) => spawnNeed("money", numNeeds);
|
|
|
|
|
|
|
|
public GameObject spawnNeed(string needName, float numNeeds)
|
2024-04-05 14:08:45 +02:00
|
|
|
{
|
2024-04-05 14:34:32 +02:00
|
|
|
|
|
|
|
GameObject spawnedNeed = null;
|
2024-04-05 17:29:05 +02:00
|
|
|
string context = "";
|
2024-04-05 14:34:32 +02:00
|
|
|
|
2024-04-05 14:08:45 +02:00
|
|
|
switch (needName)
|
|
|
|
{
|
|
|
|
case "coffee":
|
2024-04-07 03:38:32 +02:00
|
|
|
spawnedNeed = Instantiate(GameManager.Instance.Needs[0], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), GameManager.Instance.Needs[0].transform.rotation);
|
2024-04-06 21:43:51 +02:00
|
|
|
context = "The Developer wants Gottfried to bring him a coffee";
|
2024-04-05 14:08:45 +02:00
|
|
|
break;
|
|
|
|
case "mate":
|
2024-04-07 03:38:32 +02:00
|
|
|
spawnedNeed = Instantiate(GameManager.Instance.Needs[1], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), GameManager.Instance.Needs[0].transform.rotation);
|
2024-04-06 21:43:51 +02:00
|
|
|
context = "The Developer wants Gottfried to bring him a Blub Mate (Yes, its a drink called Blub Mate)";
|
2024-04-05 14:08:45 +02:00
|
|
|
break;
|
|
|
|
case "toilet":
|
2024-04-07 03:38:32 +02:00
|
|
|
spawnedNeed = Instantiate(GameManager.Instance.Needs[2], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), GameManager.Instance.Needs[0].transform.rotation);
|
2024-04-06 20:02:57 +02:00
|
|
|
context = "The Developer wants to go to the toilet";
|
2024-04-05 14:08:45 +02:00
|
|
|
break;
|
2024-04-06 18:30:26 +02:00
|
|
|
case "hunger":
|
2024-04-07 03:38:32 +02:00
|
|
|
spawnedNeed = Instantiate(GameManager.Instance.Needs[3], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), GameManager.Instance.Needs[0].transform.rotation);
|
2024-04-06 21:43:51 +02:00
|
|
|
context = "The Developer wants Gottfried to bring him a pizza";
|
|
|
|
break;
|
|
|
|
case "money":
|
2024-04-07 03:38:32 +02:00
|
|
|
spawnedNeed = Instantiate(GameManager.Instance.Needs[3], new Vector3(0.0f, 2f + (numNeeds * 0.5f), 0.0f), GameManager.Instance.Needs[0].transform.rotation);
|
2024-04-06 21:43:51 +02:00
|
|
|
context = "The Developer wants a raise, The Developer needs more money";
|
2024-04-05 14:08:45 +02:00
|
|
|
break;
|
|
|
|
default:
|
2024-04-05 19:24:26 +02:00
|
|
|
Debug.LogError($"Unbekannter need \"{needName}\"");
|
2024-04-05 14:08:45 +02:00
|
|
|
break;
|
|
|
|
}
|
2024-04-05 14:34:32 +02:00
|
|
|
|
|
|
|
if (spawnedNeed != null)
|
|
|
|
{
|
|
|
|
spawnedNeed.transform.SetParent(transform, false);
|
2024-04-05 17:29:05 +02:00
|
|
|
spawnedNeed.transform.localScale = new Vector3(0.4f, 0.01f, 0.4f);
|
2024-04-05 18:11:26 +02:00
|
|
|
if (!_audioSource.isPlaying)
|
|
|
|
{
|
2024-04-06 21:43:51 +02:00
|
|
|
_text2speech.Generate(context, 1);
|
2024-04-05 18:11:26 +02:00
|
|
|
}
|
2024-04-05 16:14:51 +02:00
|
|
|
return spawnedNeed;
|
2024-04-05 14:34:32 +02:00
|
|
|
}
|
2024-04-05 16:14:51 +02:00
|
|
|
return null;
|
2024-04-05 14:08:45 +02:00
|
|
|
}
|
2024-04-05 13:18:15 +02:00
|
|
|
}
|