You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.2 KiB
36 lines
1.2 KiB
5 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class OnwayContent : MonoBehaviour {
|
||
|
|
||
|
public GameObject itemPre;
|
||
|
public void CreateItems(Dictionary<string, List<KeyValuePair<FireCarEngine, int>>> allCars)
|
||
|
{
|
||
|
for (int i = 0; i < transform.childCount; i++)
|
||
|
{
|
||
|
Destroy(transform.GetChild(i).gameObject);
|
||
|
}
|
||
|
if (itemPre == null)
|
||
|
{
|
||
|
itemPre = Resources.Load("OnwayForce/OnwayForceItem") as GameObject;
|
||
|
}
|
||
|
foreach(string team in allCars.Keys)
|
||
|
{
|
||
|
/*foreach(KeyValuePair<FireCarEngine,int> pair in allCars[team])
|
||
|
{
|
||
|
GameObject item = Instantiate(itemPre, transform);
|
||
|
item.GetComponent<OnwayForceItem>().Set(team, pair);
|
||
|
}*/
|
||
|
foreach(KeyValuePair<FireCarEngine,int> pair in allCars[team])
|
||
|
{
|
||
|
for(int i = 0; i < pair.Value; i++)
|
||
|
{
|
||
|
GameObject item = Instantiate(itemPre, transform);
|
||
|
item.GetComponent<OnwayForceItem>().Set(team, i + 1, pair.Key);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|