Exemple #1
0
        /// <summary>
        /// Creates building from data model.
        /// </summary>
        /// <param name="building">Data model building.</param>
        public Building(Common.DataModel.Building building)
            : this()
        {
            for (int i = 0; i < building.Floors.Count; i++)
                Floors.Add(new Floor(building.Floors[i]));

            for (int i = 0; i < building.Stairs.Count; i++)
            {
                var temp = building.Stairs[i];
                var stairsPair = new StairsPair(Stairs, temp);
                stairsPair.First.AssignedSegment = Floors.Where(x => x.Level == temp.First.Level).First().Segments[temp.First.Row][temp.First.Col];
                stairsPair.Second.AssignedSegment = Floors.Where(x => x.Level == temp.Second.Level).First().Segments[temp.Second.Row][temp.Second.Col];
                stairsPair.SetAdditionalData();
                Stairs.Add(stairsPair);
            }

            CurrentFloor = Floors[0];
            UpdateFlow();
        }
Exemple #2
0
        public override void MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            SegmentSide segmentSide = ProcessEventArg(sender, e);

            var segment = segmentSide.Segment;

            // Do not override another stairs.
            if (segment.Type == SegmentType.STAIRS) return;

            segment.Type = (segment.Type == SegmentType.STAIRS ? SegmentType.NONE : SegmentType.STAIRS);
            segment.Orientation = segmentSide.Side;

            if (_firstStairs)
            {
                _stairsPair = new StairsPair(_editor.CurrentBuilding.Stairs);
                _stairsPair.First = new Stairs()
                {
                    AssignedSegment = segment,
                    EntranceCapacity = EntranceCapacity,
                    Capacity = Capacity,
                    Delay = Delay,
                    Level = _editor.CurrentBuilding.CurrentFloor.Level
                };
            }
            else
            {
                _stairsPair.Second = new Stairs()
                {
                    AssignedSegment = segment,
                    Capacity = Capacity,
                    Delay = Delay,
                    Level = _editor.CurrentBuilding.CurrentFloor.Level
                };

                _stairsPair.SetAdditionalData();
                _editor.CurrentBuilding.Stairs.Add(_stairsPair);
            }

            _firstStairs = !_firstStairs;
            UpdateMessage();

            _editor.CurrentBuilding.CurrentFloor.UpdateRender();
        }
Exemple #3
0
 public StairsPair(ObservableCollection<StairsPair> stairs, StairsPair other)
 {
     _stairs = stairs;
     First = new Stairs(other.First);
     Second = new Stairs(other.Second);
 }