/// <summary> /// Create a new path segment /// </summary> /// <param name="data">The building data</param> /// <param name="worldPosition">The position snapped to the isometric grid</param> public PathSegment(PathData data, Pair<int> worldPosition) { this.data = data; this.WorldPosition = worldPosition; var overlapElement = CampusManager.Instance.ElementAtWorldPosition(worldPosition.x, worldPosition.y); this.IsValidSegment = overlapElement == null || overlapElement is Path; }
/// <summary> /// Create a ghost path to build a new section of path /// </summary> /// <param name="data"></param> public GhostPath(PathData data) : base(data) { this.startClickLocation = null; this.Position = Input.IsoWorld.Clone(); this.segments = new List<PathSegment>(); this.ghostCursor = new PathSegment(this.data, Input.IsoWorld); this.Position = Input.IsoWorld.Clone(); }
/// <summary> /// Load a path from Config /// </summary> /// <param name="config"></param> /// <returns></returns> private PathData LoadPath(Config config, string key) { // Create the building data PathData data = new PathData(); data.Key = key; data.Name = config.GetStringValue(key, "title", ""); data.Type = DataType.Path; data.InToolbox = config.GetBoolValue(key, "toolbox", false); data.ImageName = config.GetStringValue(key, "image", ""); data.IconImageName = config.GetStringValue(key, "icon", null); data.Cost = config.GetIntValue(key, "cost", 0); return data; }