GameVsJam/3d Prototyp/Assets/Scripts/DeveloperNeeds.cs

50 lines
1.3 KiB
C#
Raw Normal View History

2024-04-05 13:18:15 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DeveloperNeeds : MonoBehaviour
{
[SerializeField] List<GameObject> Needs = new List<GameObject>();
2024-04-05 13:18:15 +02:00
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void spawnNeed(string needName)
{
2024-04-05 14:34:32 +02:00
GameObject spawnedNeed = null;
switch (needName)
{
case "coffee":
2024-04-05 14:34:32 +02:00
spawnedNeed = Instantiate(Needs[0], new Vector3(0.0f, 1.5f, 0.0f), Needs[0].transform.rotation);
break;
case "mate":
2024-04-05 14:34:32 +02:00
spawnedNeed = Instantiate(Needs[1], new Vector3(0.0f, 1.5f, 0.0f), Needs[0].transform.rotation);
break;
case "toilet":
2024-04-05 14:34:32 +02:00
spawnedNeed = Instantiate(Needs[2], new Vector3(0.0f, 1.5f, 0.0f), Needs[0].transform.rotation);
break;
case "money":
2024-04-05 14:34:32 +02:00
spawnedNeed = Instantiate(Needs[3], new Vector3(0.0f, 1.5f, 0.0f), Needs[0].transform.rotation);
break;
default:
break;
}
2024-04-05 14:34:32 +02:00
if (spawnedNeed != null)
{
spawnedNeed.transform.SetParent(transform, false);
}
}
2024-04-05 13:18:15 +02:00
}