コード例 #1
0
        public override bool Link(BaseLevel level, out BaseTrack[] results)
        {
            if (_direction != Direction.None)
            {
                results = null;
                return false;
            }

            results = level.GetTracksFacing(_position, Direction.East);

            bool valid = (results.Length != 0);
            if (valid)
                _next = results[0];

            return valid;
        }
コード例 #2
0
        public override bool Link(BaseLevel level, out BaseTrack[] results)
        {
            if (_direction != Direction.None)
            {
                results = null;
                return false;
            }

            results = targets = level.GetTracksFacing(_position,
                Direction.North,
                Direction.South);

            bool valid = (targets.Length == 2);
            if (!valid)
                throw new LevelLoadException("This type of switch must have exactly two targets.");

            return valid;
        }