using System.Collections; using System.Collections.Generic; using UnityEngine; public class DeveloperNeeds : MonoBehaviour { [SerializeField] List Needs = new List(); // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public GameObject spawnNeed(string needName) { GameObject spawnedNeed = null; switch (needName) { case "coffee": spawnedNeed = Instantiate(Needs[0], new Vector3(0.0f, 1.5f, 0.0f), Needs[0].transform.rotation); break; case "mate": spawnedNeed = Instantiate(Needs[1], new Vector3(0.0f, 1.5f, 0.0f), Needs[0].transform.rotation); break; case "toilet": spawnedNeed = Instantiate(Needs[2], new Vector3(0.0f, 1.5f, 0.0f), Needs[0].transform.rotation); break; case "money": 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); return spawnedNeed; } return null; } }