/// <summary> /// Default constructor /// </summary> /// <param name="path"></param> /// <param name="userData"></param> public PathViewModel(DungeonPath path, IDungeonsController dungeonController, IWebBrowserController browserController, DungeonsUserData userData) { this.PathModel = path; this.userData = userData; this.dungeonController = dungeonController; this.browserController = browserController; this.OpenGuideCommand = new DelegateCommand(this.OpenGuide); this.SetAsActivePathCommand = new DelegateCommand(this.SetAsActivePath); this.RemoveTimesCommand = new DelegateCommand <object>(this.RemoveCompletionTimes); // Initialize the path completion data in the UserData object var existingPathCompletionData = this.userData.PathCompletionData.FirstOrDefault(pt => pt.PathID == this.PathId); if (existingPathCompletionData != null) { existingPathCompletionData.PathData = this; } else { this.userData.PathCompletionData.Add(new PathCompletionData(this)); } this.CompletionTimes.CollectionChanged += (o, e) => { this.OnPropertyChanged(() => this.BestCompletionTime); this.OnPropertyChanged(() => this.AverageCompletionTime); }; }
public void InitPlayer(DungeonPath path) { Debug.Log("init player"); this.path = path; transform.position = path.startPoint.cameraPosition.position; transform.rotation = path.startPoint.cameraPosition.rotation; currentPoint = path.startPoint; currentPoint.isCurrent = true; dungeonCanvas.SetupCellNavigation(currentPoint.owner); // MoveToPoint(path.startPoint); }
private IEnumerator GenerateCoroutine() { if (dungeonPath != null) { foreach (DungeonCell c in dungeonPath.dungeonCells) { if (c != null) { Destroy(c.gameObject); } } } dungeonPath = new DungeonPath(); dungeonPath.dungeonCells = new DungeonCell[cellCount]; StartCell(); yield return(new WaitForSeconds(0.1f)); for (int i = 1; i < cellCount; i++) { bool last = i == cellCount - 1 ? true : false; yield return(AddCell(i, last)); if (dungeonPath.dungeonCells[i - 1].blocked) { Generate(); yield break; } } for (int i = 0; i < branchCount; i++) { //find a start point for the branch var startCell = dungeonPath.dungeonCells[UnityEngine.Random.Range(2, cellCount - 2)]; } player.InitPlayer(dungeonPath); }
/// <summary> /// Default constructor /// </summary> /// <param name="path"></param> /// <param name="userSettings"></param> public PathViewModel(DungeonPath path, DungeonSettings userSettings) { this.PathModel = path; this.userSettings = userSettings; }