コード例 #1
0
ファイル: SwitchTrack.cs プロジェクト: robhendriks/GoldFever
 public SwitchMode Compare(Vector target)
 {
     if (target.Y < Position.Y)
         return SwitchMode.Up;
     else if (target.Y > Position.Y)
         return SwitchMode.Down;
     else
         throw new ArgumentException("Invalid target {target}.");
 }
コード例 #2
0
ファイル: EndTrack.cs プロジェクト: robhendriks/GoldFever
 public EndTrack(Vector position, Direction direction)
     : base(position, direction)
 {
 }
コード例 #3
0
ファイル: StartTrack.cs プロジェクト: robhendriks/GoldFever
 public StartTrack(Vector position, Direction direction)
     : base(position, direction)
 {
 }
コード例 #4
0
ファイル: BaseLevel.cs プロジェクト: robhendriks/GoldFever
        public BaseTrack[] GetTracksFacing(Vector position, params Direction[] directions)
        {
            var results = new List<BaseTrack>();

            Vector pos;
            BaseTrack target;

            foreach (var direction in directions)
            {
                if (direction == Direction.None)
                    continue;

                pos = position.Facing(direction);
                target = GetTrackAt(pos);

                if (target == null)
                    continue;

                results.Add(target);
            }

            return results.ToArray();
        }
コード例 #5
0
ファイル: SwitchTrack.cs プロジェクト: robhendriks/GoldFever
 public SwitchTrack(Vector position, Direction direction, ConsoleKey key)
     : base(position, direction)
 {
     _key = key;
     _mode = SwitchMode.Down;
 }
コード例 #6
0
ファイル: BaseLevel.cs プロジェクト: robhendriks/GoldFever
        public BaseTrack GetTrackAt(Vector position)
        {
            foreach (var track in _tracks)
                if (track.Position.Equals(position))
                    return track;

            return null;
        }
コード例 #7
0
ファイル: BaseTrack.cs プロジェクト: robhendriks/GoldFever
 public BaseTrack(Vector position, Direction direction)
 {
     _position = position;
     _direction = direction;
 }
コード例 #8
0
ファイル: DefaultTrack.cs プロジェクト: robhendriks/GoldFever
 public DefaultTrack(Vector position, Direction direction)
     : base(position, direction)
 {
 }
コード例 #9
0
 public SwitchOutTrack(Vector position, Direction direction, ConsoleKey key)
     : base(position, direction, key)
 {
 }
コード例 #10
0
ファイル: Vector.cs プロジェクト: robhendriks/GoldFever
 public bool Equals(Vector other)
 {
     return (X == other.X) && (Y == other.Y);
 }