예제 #1
0
 private void TriggerOpenDoorInput()
 {
     if (BtnDown.GetComponent <BtnDownPush>().isWithinOpenZoneBtnDown)
     {
         StartCoroutine(BtnDownPush());
     }
     if (BtnUp.GetComponent <BtnUpPush>().isWithinOpenZoneBtnUp)
     {
         StartCoroutine(BtnUpPush());
     }
     if (BtnUp.GetComponent <BtnUpPush>().isWithinOpenZoneBtnUp&& BtnDown.GetComponent <BtnDownPush>().isWithinOpenZoneBtnDown)
     {
         StartCoroutine(OpenDoorRoutine());
     }
 }
        /// <summary>
        /// Updates all the room related buttons, including displaying the correct text depending on doors etc.
        /// </summary>
        /// <param name="room"></param>
        private void UpdateButtons(Place room)
        {
            // North door
            if (North != 0)
            {
                BtnNorth.SetValue(Grid.ColumnSpanProperty, 1);
                BtnNorthDoor.Visibility = Visibility.Visible;
                BtnNorth.Content        = "View North Room";
                if (Room.NorthDoor != 0)
                {
                    BtnNorthDoor.Content = "Modify North Door";
                }
                else
                {
                    BtnNorthDoor.Content = "Create North Door";
                }
            }
            else
            {
                BtnNorthDoor.Visibility = Visibility.Collapsed;
                BtnNorth.SetValue(Grid.ColumnSpanProperty, 2);
                BtnNorth.Content = "Create North Room";
            }

            // South door
            if (South != 0)
            {
                BtnSouth.SetValue(Grid.ColumnSpanProperty, 1);
                BtnSouthDoor.Visibility = Visibility.Visible;
                BtnSouth.Content        = "View South Room";
                if (Room.SouthDoor != 0)
                {
                    BtnSouthDoor.Content = "Modify South Door";
                }
                else
                {
                    BtnSouthDoor.Content = "Create South Door";
                }
            }
            else
            {
                BtnSouthDoor.Visibility = Visibility.Collapsed;
                BtnSouth.SetValue(Grid.ColumnSpanProperty, 2);
                BtnSouth.Content = "Create South Room";
            }

            // East door
            if (East != 0)
            {
                BtnEast.SetValue(Grid.ColumnSpanProperty, 1);
                BtnEastDoor.Visibility = Visibility.Visible;
                BtnEast.Content        = "View East Room";
                if (Room.EastDoor != 0)
                {
                    BtnEastDoor.Content = "Modify East Door";
                }
                else
                {
                    BtnEastDoor.Content = "Create East Door";
                }
            }
            else
            {
                BtnEastDoor.Visibility = Visibility.Collapsed;
                BtnEast.SetValue(Grid.ColumnSpanProperty, 2);
                BtnEast.Content = "Create East Room";
            }

            // West door
            if (West != 0)
            {
                BtnWest.SetValue(Grid.ColumnSpanProperty, 1);
                BtnWestDoor.Visibility = Visibility.Visible;
                BtnWest.Content        = "View West Room";
                if (room.WestDoor != 0)
                {
                    BtnWestDoor.Content = "Modify West Door";
                }
                else
                {
                    BtnWestDoor.Content = "Create West Door";
                }
            }
            else
            {
                BtnWestDoor.Visibility = Visibility.Collapsed;
                BtnWest.SetValue(Grid.ColumnSpanProperty, 2);
                BtnWest.Content = "Create West Room";
            }

            // Up door
            if (Up != 0)
            {
                BtnUp.SetValue(Grid.ColumnSpanProperty, 1);
                BtnUpDoor.Visibility = Visibility.Visible;
                BtnUp.Content        = "View Above Room";
                if (room.UpDoor != 0)
                {
                    BtnUpDoor.Content = "Modify Above Door";
                }
                else
                {
                    BtnUpDoor.Content = "Create Above Door";
                }
            }
            else
            {
                BtnUpDoor.Visibility = Visibility.Collapsed;
                BtnUp.SetValue(Grid.ColumnSpanProperty, 2);
                BtnUp.Content = "Create Above Room";
            }

            // Down door
            if (Down != 0)
            {
                BtnDown.SetValue(Grid.ColumnSpanProperty, 1);
                BtnDownDoor.Visibility = Visibility.Visible;
                BtnDown.Content        = "View Below Room";
                if (room.DownDoor != 0)
                {
                    BtnDownDoor.Content = "Modify Below Door";
                }
                else
                {
                    BtnDownDoor.Content = "Create Below Door";
                }
            }
            else
            {
                BtnDownDoor.Visibility = Visibility.Collapsed;
                BtnDown.SetValue(Grid.ColumnSpanProperty, 2);
                BtnDown.Content = "Create Below Room";
            }
        }