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

52 lines
1.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DeveloperNeeds : MonoBehaviour
{
[SerializeField] List<GameObject> Needs = new List<GameObject>();
// 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;
}
}