コード例 #1
0
ファイル: Path.cs プロジェクト: GoodSky/Sim-U
        /// <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;
        }
コード例 #2
0
ファイル: GhostPath.cs プロジェクト: GoodSky/Sim-U
        /// <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();
        }
コード例 #3
0
ファイル: CampusCatalog.cs プロジェクト: GoodSky/Sim-U
        /// <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;
        }