void RestSkill() { RoleData.BoxAttr box = new RoleData.BoxAttr(); box.makeCount = 1; box.timeMin = staticMakeData.skillMin; box.timeMax = staticMakeData.skillMax; List <RoleData.BoxAttr> list = new List <RoleData.BoxAttr>(); list.Add(box); RoleData.CycleAttr cycle = new RoleData.CycleAttr(); cycle.countMax = staticMakeData.countMax; cycle.intervalMin = 1; cycle.boxList = list; staticAttr = cycle; TimerThearData a = new TimerThearData(); a.Reset(list); a.isRun[0] = true; a.curMakeCount[0] = 1; a.totalCreateTime[0] = staticMakeData.skillMax; a.type = CycleType.Loop; createTimer[SkillList] = a; }
//生成一个固定的 静态块生成线程 public void RestOnceStaticThread() { int rand = UnityEngine.Random.Range(0, 100); int count = 0; if (rand < staticMakeData.makeBoxCountRate[2]) { count = 3; } else if (rand < staticMakeData.makeBoxCountRate[1]) { count = 2; } else if (rand < staticMakeData.makeBoxCountRate[0]) { count = 1; } //生成一个 块生成线程 RoleData.BoxAttr box = new RoleData.BoxAttr(); box.makeCount = count; box.timeMax = staticMakeData.maxTime; box.timeMin = staticMakeData.minTime; List <RoleData.BoxAttr> list = new List <RoleData.BoxAttr>(); list.Add(box); RoleData.CycleAttr cycle = new RoleData.CycleAttr(); cycle.countMax = staticMakeData.countMax; cycle.intervalMin = 0; cycle.boxList = list; staticAttr = cycle; TimerThearData a = new TimerThearData(); a.Reset(list); a.isRun[0] = true; a.curMakeCount[0] = count; a.curMakeBoxCount[0] = count; a.totalCreateTime[0] = staticMakeData.countMax; a.type = CycleType.Loop; createTimer[StaticList] = a; }
RoleData.CycleAttr getCycleData(string[] r) { List <string> str = new List <string>(); for (int i = 0; i < r.Length; i++) { if (!r[i].Equals("")) { str.Add(r[i]); } } int arrylenght = (str.Count - 3) / 6; RoleData.CycleAttr cycle = new RoleData.CycleAttr(); RoleData.BoxAttr[] boxList = new RoleData.BoxAttr[arrylenght]; for (int i = 0; i < boxList.Length; i++) { boxList[i] = new RoleData.BoxAttr(); } for (int i = 0; i < str.Count; i++) { float num = 0; if (float.TryParse(str[i], out num)) { } else { //转换失败, 字符串不是只是数字 Debug.Log("这个不是数字 " + i); } if (i - 2 > 0) { int temp = i - 3; int arrIndex = temp / 6; int index = temp - (arrIndex * 6); if (arrIndex >= 5) { Debug.Log(arrIndex + "/" + i); } if (arrIndex < arrylenght) { switch (index) { case 0: boxList[arrIndex].type = (int)num; break; case 1: boxList[arrIndex].timeMin = num; break; case 2: boxList[arrIndex].timeMax = num; break; case 3: boxList[arrIndex].makeCount = (int)num; break; case 4: boxList[arrIndex].width = num; break; case 5: boxList[arrIndex].moveSpeed = num; break; } } } else { switch (i) { case 1: cycle.countMax = (int)num; break; case 2: cycle.intervalMin = num; break; } } } cycle.boxList = new List <RoleData.BoxAttr>(boxList); return(cycle); }