- 最后登录
- 2016-8-29
- 注册时间
- 2012-8-25
- 阅读权限
- 90
- 积分
- 23585
- 纳金币
- 20645
- 精华
- 62
|
- using unityEngine;
- using System.Collections;
- using System.Collections.Generic;
- public class list : MonoBehaviour {
- List<string> ListName = new List<string>();
- void Start () {
- ListName.Add ("a1");
- ListName.Add ("b2");
- ListName.Add ("c3");
- ListName.Add ("d4");
- ListName.Add ("e5");
- ListName.Add ("f6");
- ListName = RandName (ListName);
- foreach (string name in ListName) {
- print(name);
- }
- }
- //suiji shuzu
- List<string>RandName(List<string>OldName)
- {
- List<string> NListName=new List<string>();
- while (NListName.Count<OldName.Count) {
- int i=Random.Range(0,OldName.Count);
- if(!NListName.Contains(OldName[i]))
- NListName.Add(OldName[i]);
- }
- return NListName;
- }
- }
复制代码 |
|