public void SetMission(int level, Define.MissionType type) { if (!nowMissions.ContainsKey(level)) { nowMissions.Add(level, new Mission()); } nowMissions[level].SetNewMission(type, level); }
public bool TryGetRandomMissionType(int level, ref Define.MissionType type) { if (missionDic.ContainsKey(level)) { int randCount = Random.Range(0, missionDic[level].Count); type = missionDic[level][randCount].missionType; return(true); } return(false); }
public MissionTable GetMissionTable(Define.MissionType type, int level) { if (missionDic.ContainsKey(level)) { for (int i = 0, max = missionDic[level].Count; i < max; i++) { if (missionDic[level][i].missionType == type) { return(missionDic[level][i]); } } } return(null); }
public void MakeRandomMissions() { nowMissionLevel = 0; nowMissions.Clear(); for (int i = 0; i < Define.missionLevelCount; i++) { nowMissions.Add(i, new Mission()); Define.MissionType type = Define.MissionType.ClearLines; if (DataManager.GetInstance().TryGetRandomMissionType(i, ref type)) { nowMissions[i].SetNewMission(type, i); } } InitData(); }
protected override void Init() { base.Init(); missionDic = new Dictionary <Define.MissionType, MissionBase>(); for (int i = 0, max = missionList.Count; i < max; i++) { Define.MissionType type = missionList[i].type; if (missionDic.ContainsKey(type)) { Debug.Log("something is wrong"); } else { missionDic.Add(type, missionList[i]); } } }
private void SetMissionData(string savedData) { if (string.IsNullOrEmpty(savedData)) { Debug.Log("No Saved Data : MissionData"); } else { int count = 0; string[] strElement = dataController.GetStringElements(savedData); int size = strElement.Length; while (size > count) { int level = TryToParseInt(strElement, count++, 0); Define.MissionType type = (Define.MissionType)TryToParseInt(strElement, count++, 0); MissionManager.GetInstance().SetMission(level, type); } } }
public void SetNewMission(Define.MissionType type, int lv) { missionType = type; missionLevel = lv; isCleared = false; }