forked from zxl/LaboratoryProtection
33 lines
664 B
C#
33 lines
664 B
C#
using System.Linq;
|
|
|
|
using UnityEngine;
|
|
|
|
public class RandomQuestion : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private QuestionPage _page;
|
|
|
|
private void Reset()
|
|
{
|
|
this._page = this.GetComponent<QuestionPage>();
|
|
}
|
|
|
|
public int count = 20;
|
|
|
|
private void Start()
|
|
{
|
|
var list = _page.questions.ToList();
|
|
Enumerable
|
|
.Range(0, 10)
|
|
.Select(_ => {
|
|
Debug.Log(list.Count);
|
|
var index = Random.Range(0, list.Count);
|
|
list.RemoveAt(index);
|
|
return index;
|
|
})
|
|
.ToArray();
|
|
|
|
_page.questions = list.ToArray();
|
|
}
|
|
}
|