示例#1
0
 public Ship(WaterTrack track)
 {
     PlacedOn       = track;
     IsHidden       = false;
     SailAway       = true;
     IsFull         = false;
     _contentAmount = 0;
 }
示例#2
0
 public DockTrack(char symbol, Track waterAtDock)
     : base(symbol)
 {
     _waterAtDock = (WaterTrack)waterAtDock;
 }
示例#3
0
        public void AddTrack(int i, int j, char c, Track[,] map)
        {
            switch (c)
            {
            case '-':
                if (i == 4 && j == 0)
                {
                    map[i, j] = new FinalTrack(c);
                }
                else
                {
                    map[i, j] = new BaseTrack(c);
                }
                break;

            case '!':
                _numOfSwitches++;
                if (!(map[i, j - 1].GetSymbol().Equals('-')))
                {
                    map[i, j] = new JoinTrack(_numOfSwitches, Direction.DOWN);
                }
                else
                {
                    map[i, j] = new ForkTrack(_numOfSwitches, Direction.DOWN);
                }
                break;

            case '¡':
                _numOfSwitches++;
                if (!(map[i, j - 1].GetSymbol().Equals('-')))
                {
                    map[i, j] = new JoinTrack(_numOfSwitches, Direction.UP);
                }
                else
                {
                    map[i, j] = new ForkTrack(_numOfSwitches, Direction.DOWN);
                }
                break;

            case '=':
                map[i, j] = new HoldingTrack(c);
                break;

            case 'K':
                map[i, j] = new DockTrack(c, _waterAtDock);
                break;

            case 'A':
            case 'B':
            case 'C':
                map[i, j] = new Warehouse(c);
                break;

            case ' ':
                map[i, j] = new SpaceTrack(c);
                break;

            case '0':
                _waterAtDock      = new WaterTrack(':');
                Ship              = new Ship(_waterAtDock);
                _waterAtDock.Ship = Ship;
                map[i, j]         = _waterAtDock;
                break;

            case ':':
            case '~':
                map[i, j] = new WaterTrack(c);
                break;

            default:
                break;
            }
        }