Started working on building, next to add in spawn location for buildings for units, transporting materials from TownHall/Storage to building site, building naimation continues while building, houses spawn the correct amount of units (not just 1)
This commit is contained in:
35
Assets/Scripts/UnitManagement.cs
Normal file
35
Assets/Scripts/UnitManagement.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user