コード例 #1
0
 void ExplainerPieceAddedToRocket(GameObject pieceAdded, int pieceType, int oldParentType, int oldParentOutlineIndex, int newParentOutlineIndex)
 {
     if (gameController.IsRocketComplete())
     {
         explainerCompleteButton.SetActive(true);
     }
     else
     {
         explainerCompleteButton.SetActive(false);
     }
 }
        void Start()
        {
            // set up the scene
            gameController.SetUpExplainerScene();
            gameController.PlaceExistingRocketPiecesOnRocketOutlines();

            // enable drag and drop functionality
            gameController.EnableDragAndDropGameplay();

            // initialize the buttons
            if (gameController.IsRocketComplete())
            {
                builderCompleteButton.SetActive(true);
            }
            else
            {
                builderCompleteButton.SetActive(false);
            }
            switchToExplainerButton.SetActive(true);

            // have the rocket label (child/caregiver) represent the true state of the game
            if (gameController.childExplainer)
            {
                playerIndicatorText.text = Constants.CAREGIVER_ROCKET_STRING;
            }
            else
            {
                playerIndicatorText.text = Constants.CHILD_ROCKET_STRING;
            }

            // display the appropriate text in the tutorial button
            if (gameController.tutorialMode == Constants.TUTORIAL_ON)
            {
                tutorialButton.SetActive(true);
            }
            else if (gameController.tutorialMode == Constants.TUTORIAL_OFF)
            {
                tutorialButton.SetActive(false);
            }

            // subscribe to appropriate events
            Slot.OnPieceAddedToRocket         += BuilderPieceAddedToRocket;
            DragHandler.OnPieceRemovedByTrash += BuilderPieceRemoved;
        }