public void AddPath(ActionTrail _path, int _newPerson, bool _newAction) { pathOfActions.trail.AddRange(_path.trail); ActionTrail tempTrail = new ActionTrail(_newPerson, _newAction); pathOfActions.trail.AddRange(tempTrail.trail); }
public List<ValidLevels> DeseriealizeLevels() { List<ValidLevels> _list = new List<ValidLevels>(); string listText = fileIO.GetFileText(); List<string> _eachLine = new List<string>(); _eachLine.AddRange(listText.Split('\n')); if (_eachLine.Contains("")) { _eachLine.Remove(""); } // remove possible trailing line foreach (string line in _eachLine) { if (!line.StartsWith("//")) { Difficulty thisDifficulty = Difficulty.Unknown; int thisSeed = 0; int thisLevel = 0; int thisCantTouch = 0; bool thisOneClick = false; int thisNumClick = 0; string lineWithoutEnding = line.Split('\r')[0]; string[] tokens = lineWithoutEnding.Split(','); int a; bool b; if (int.TryParse((tokens[0].Split(':')[1]), out a)) { thisLevel = a; } // set the level string _diff = tokens[1].Split(':')[1]; // set the difficulty if (_diff == "VeryEasy") { thisDifficulty = Difficulty.VeryEasy; } else if (_diff == "Easy") { thisDifficulty = Difficulty.Easy; } else if (_diff == "Medium") { thisDifficulty = Difficulty.Medium; } else if (_diff == "Hard") { thisDifficulty = Difficulty.Hard; } if (int.TryParse((tokens[2].Split(':')[1]), out a)) { thisSeed = a; } // set the seed if (int.TryParse((tokens[3].Split(':')[1]), out a)) { thisNumClick = a; } // set the numClicks if (bool.TryParse((tokens[4].Split(':')[1]), out b)) { thisOneClick = b; } // set the oneClick possibility if (int.TryParse((tokens[5].Split(':')[1]), out a)) { thisCantTouch = a; } // set who you cant touch, if possible ActionTrail thisPath = new ActionTrail(tokens[6]); ActionTrail thisCantTouchPath = new ActionTrail(tokens[7]); ValidLevels lvl = new ValidLevels(thisLevel, thisDifficulty, thisSeed, thisCantTouch, thisOneClick, thisNumClick, thisCantTouchPath.trail.Count); lvl.path = thisPath; lvl.cantTouchPath = thisCantTouchPath; _list.Add(lvl); } } return _list; }
public void InitializeStart() { isWinningState = false; numStepsToReach = 0; isNull = false; pathOfActions = new ActionTrail(true); }
public levelTesterState_s(List <Mood> _m, bool _w, int _n) { myState = _m; isWinningState = _w; numStepsToReach = _n; isNull = false; pathOfActions = new ActionTrail(true); }
public levelTesterState_s(List<Mood> _m, bool _w, int _n) { myState = _m; isWinningState = _w; numStepsToReach = _n; isNull = false; pathOfActions = new ActionTrail(true); }
public List <ValidLevels> DeseriealizeLevels() { List <ValidLevels> _list = new List <ValidLevels>(); string listText = fileIO.GetFileText(); List <string> _eachLine = new List <string>(); _eachLine.AddRange(listText.Split('\n')); if (_eachLine.Contains("")) { _eachLine.Remove(""); } // remove possible trailing line foreach (string line in _eachLine) { if (!line.StartsWith("//")) { Difficulty thisDifficulty = Difficulty.Unknown; int thisSeed = 0; int thisLevel = 0; int thisCantTouch = 0; bool thisOneClick = false; int thisNumClick = 0; string lineWithoutEnding = line.Split('\r')[0]; string[] tokens = lineWithoutEnding.Split(','); int a; bool b; if (int.TryParse((tokens[0].Split(':')[1]), out a)) { thisLevel = a; } // set the level string _diff = tokens[1].Split(':')[1]; // set the difficulty if (_diff == "VeryEasy") { thisDifficulty = Difficulty.VeryEasy; } else if (_diff == "Easy") { thisDifficulty = Difficulty.Easy; } else if (_diff == "Medium") { thisDifficulty = Difficulty.Medium; } else if (_diff == "Hard") { thisDifficulty = Difficulty.Hard; } if (int.TryParse((tokens[2].Split(':')[1]), out a)) { thisSeed = a; } // set the seed if (int.TryParse((tokens[3].Split(':')[1]), out a)) { thisNumClick = a; } // set the numClicks if (bool.TryParse((tokens[4].Split(':')[1]), out b)) { thisOneClick = b; } // set the oneClick possibility if (int.TryParse((tokens[5].Split(':')[1]), out a)) { thisCantTouch = a; } // set who you cant touch, if possible ActionTrail thisPath = new ActionTrail(tokens[6]); ActionTrail thisCantTouchPath = new ActionTrail(tokens[7]); ValidLevels lvl = new ValidLevels(thisLevel, thisDifficulty, thisSeed, thisCantTouch, thisOneClick, thisNumClick, thisCantTouchPath.trail.Count); lvl.path = thisPath; lvl.cantTouchPath = thisCantTouchPath; _list.Add(lvl); } } return(_list); }