36 lines
784 B
C#
36 lines
784 B
C#
|
|
using System;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class UnitManagement : MonoBehaviour
|
||
|
|
{
|
||
|
|
public static UnitManagement Instance;
|
||
|
|
[SerializeField] GameObject npcPrefab;
|
||
|
|
void Awake()
|
||
|
|
{
|
||
|
|
Instance = this;
|
||
|
|
}
|
||
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||
|
|
void Start()
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
// Update is called once per frame
|
||
|
|
void Update()
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
public void CreateUnit(String unit, int quantity, Vector3 spawnLocation)
|
||
|
|
{
|
||
|
|
for (int i = 0; i < quantity; i++)
|
||
|
|
{
|
||
|
|
switch (unit)
|
||
|
|
{
|
||
|
|
case "Citizen":
|
||
|
|
Instantiate(npcPrefab, spawnLocation, Quaternion.identity);
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|