2025-11-27 14:50:16 +08:00
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class SetPrefabs : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
[SerializeField] private List<GameObject> cardPrefabs;
|
|
|
|
|
[SerializeField] private List<GameObject> characterPrefabs;
|
|
|
|
|
[SerializeField] private int cardNumber;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
|
{
|
|
|
|
|
foreach (GameObject go in characterPrefabs)
|
|
|
|
|
{
|
2025-12-01 14:22:40 +08:00
|
|
|
Character character = go.GetComponent<Character>();
|
|
|
|
|
character.ownedCardPrefabList.Clear();
|
2025-11-27 14:50:16 +08:00
|
|
|
for (int i = 0; i < cardNumber; i++)
|
|
|
|
|
{
|
|
|
|
|
GameObject cardPrefab = cardPrefabs[UnityEngine.Random.Range(0, cardPrefabs.Count)];
|
2025-12-01 14:22:40 +08:00
|
|
|
character.ownedCardPrefabList.Add(cardPrefab);
|
2025-11-27 14:50:16 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|