Ejemplo n.º 1
0
    public void AddRoad(TubeType type, int number)
    {
        var      tileSpawn = grid.CellToLocal(nextTilePosition);
        var      start     = tileSpawn - (nextRotation * Vector3.up * grid.cellSize.x / 2);
        Object   prefab    = null;
        Object   border    = null;
        TubeTile tile      = null;

        switch (type)
        {
        case TubeType.Forward:
            tile   = new ForwardTubeTile(start, nextRotation);
            prefab = prefabStorage.GetForward(number);
            border = prefabStorage.forwardComplete;
            break;

        case TubeType.Left:
            tile   = new LeftTubeTile(start, nextRotation);
            prefab = prefabStorage.GetAngle(number);
            border = prefabStorage.angleComplete;
            break;

        case TubeType.Right:
            tile          = new RightTubeTile(start, nextRotation);
            prefab        = prefabStorage.GetAngle(number);
            border        = prefabStorage.angleComplete;
            nextRotation *= Quaternion.Euler(0, 180, 0);
            break;
        }
        GameObject.Instantiate(prefab, grid.CellToWorld(nextTilePosition), nextRotation, grid.gameObject.transform);
        GameObject.Instantiate(border, grid.CellToWorld(nextTilePosition) + new Vector3(0, 0, -1), nextRotation, grid.gameObject.transform);
        tiles.Add(tile);
        nextTilePosition += tile.GetNextTile();
        nextRotation      = tile.GetNextRotation();
    }
Ejemplo n.º 2
0
 public void SetToStay()
 {
     Console.WriteLine("Changing " + _toolTipString.ToString() + " to Stay.");
     _type   = TubeType.STAY;
     _stroke = Brushes.Transparent;
     _fill   = Brushes.Transparent;
 }
Ejemplo n.º 3
0
 public void SetToPlug()
 {
     _type   = TubeType.PLUG;
     _stroke = Brushes.Gray;
     _fill   = Brushes.Gray;
     _symbol = "P";
     NotifyPropertyChanged("Symbol");
 }
Ejemplo n.º 4
0
        public Image GetImage(TubeType dir)
        {
            Image image = new Image
            {
                Source  = images[dir].Source,
                Stretch = Stretch.Fill
            };

            return(image);
        }
Ejemplo n.º 5
0
        public TubeViewModel(ZetecXMLModels.Tube tube)
        {
            _type            = TubeType.TUBE;
            _selectCommand   = new RelayCommand(SelectTube, true);
            _deselectCommand = new RelayCommand(DeselectTube, true);

            _id      = tube.ID;
            _inletx  = tube.InletX;
            _inlety  = tube.InletY;
            _outletx = tube.OutletX;
            _outlety = tube.OutletY;
            _ylabel  = tube.YLabel;
            _xlabel  = tube.XLabel;

            _toolTipString = "Y" + tube.YLabel + "X" + tube.XLabel;
        }
Ejemplo n.º 6
0
 public Tube(TubeType _tubeType)
 {
     tubeType = _tubeType;
     image    = ImageHolder.GetInstance().GetImage(tubeType);
 }
Ejemplo n.º 7
0
        private Tube GenerateTube()
        {
            TubeType type = (TubeType)rand.Next(2, 7);

            return(new Tube(type));
        }
Ejemplo n.º 8
0
 public void SetToTube()
 {
     _type   = TubeType.TUBE;
     _stroke = Brushes.Gray;
     _fill   = Brushes.Transparent;
 }