예제 #1
0
 // also toggles the button's interactable property, and reappears the piece controls panel if applicable
 public void setResettable(bool resettable)
 {
     gameObject.GetComponent <Button>().interactable = resettable;
     this.resettable = resettable;
     if (!resettable)
     {
         if (startStopButtonScript != null)
         {
             startStopButtonScript.setButtonState("start");
         }
         pieceControlsPanel.SetActive(true);
     }
 }
예제 #2
0
 // this method removes the active piece's halo (if there is an active piece), changes its colliders to triggers, sets the activePiece variable to null, and changes the state of canvas objects
 // this method does NOT remove a piece, but it does check if there are any pieces remaining (and deactivates the piece controls panel, etc. if there aren't)
 // it is fine to call this method in this or another class
 public void ClearActivePiece(){
     if(activePiece != null){
         Behaviour halo = activePiece.GetComponent<PiecePrefabBehaviour>().getHalo() as Behaviour;
         halo.enabled = false;
         activePiece.GetComponent<PiecePrefabBehaviour>().setTriggers(true);
         activePiece = null;
     }
     if(pieceControlsPanel.activeInHierarchy){
         pieceControlsLabel.GetComponent<Text>().text = "Touch a piece to edit it";
         SetAllPieceControlsButtonsInteractable(false);
     }
     if(pieces.Count == 0){
         pieceControlsPanel.SetActive(false);
         startStopButton.interactable = false;
         
         if(!resetButtonScript.getResettable()){ // don't make any of the following changes if the contraption is merely paused
             piecesScrollView.SetActive(true);
             startStopButtonScript.setButtonState("start");
             clearAllButton.interactable = false;
             SetTopButtonsVisible(false);
         }
     }
 }