void Update()
 {
     if (enabled && !original.IsFilling())
     {
         //			playerController.canMove (false);
                     #if UNITY_STANDALONE
         if (Input.GetButtonDown("Fire1") && playerNeedle.IsAttackEnabled())
         {
             if (this.partitionPointer > -1)
             {
                 playerNeedle.getNeedleThrowing().setPullTowards(false);
                 fill();
             }
             else
             {
                 SoundManager.Instance.Play(AudibleNames.Results.MISTAKE, false);
             }
         }
         else if (Input.GetButtonDown("Fire2") && playerNeedle.IsAttackEnabled())
         {
             playerNeedle.getNeedleThrowing().setPullTowards(true);
             fill();
         }
         else if (Input.GetKeyDown(KeyCode.D))                  // TODO: Check if has mobile input
         {
             increasePartition();
         }
         else if (Input.GetKeyDown(KeyCode.A))                  // TODO: Check if has mobile input
         {
             decreasePartition();
         }
                     #elif UNITY_ANDROID
         if (mobile.interactPressed && playerNeedle.IsAttackEnabled())
         {
             playerNeedle.getNeedleThrowing().setPullTowards(false);
             fill();
         }
         else if (mobile.chargePressed && playerNeedle.IsAttackEnabled())
         {
             playerNeedle.getNeedleThrowing().setPullTowards(false);                   // TODO remove
             fill();
         }
         else if (mobile.rightPressed)
         {
             increasePartition();
             mobile.rightPressed = false;
         }
         else if (mobile.leftPressed)
         {
             decreasePartition();
             mobile.leftPressed = false;
         }
                     #endif
     }
 }
Example #2
0
    private IEnumerator NeedleTutorial()
    {
        Debug.Log("Needle tutorial start");

        enableDialogue();         //Tutorial_4_PickedUpNeedle
        while (GameController_v7.Instance.GetDialogueManager().IsDialogueBoxPlaying())
        {
            disablePlayerControls();
            yield return(null);
        }

        GameController_v7.Instance.GetDialogueManager().ShowCG();
        yield return(new WaitForSecondsRealtime(NEEDLE_CG_WAIT));

        GameController_v7.Instance.GetDialogueManager().HideCG();

        enableDialogue();         //this happened cuz sky broke, we need to gather sky fragments
        while (GameController_v7.Instance.GetDialogueManager().IsDialogueBoxPlaying())
        {
            disablePlayerControls();
            yield return(null);
        }

        GameController_v7.Instance.GetDialogueManager().HideCG();

        enableDialogue();         //the sky fragment in the needle is reacting to the box, I think this can fix it, can you make me throw it at the box?
        while (GameController_v7.Instance.GetDialogueManager().IsDialogueBoxPlaying())
        {
            disablePlayerControls();
            yield return(null);
        }

        GameController_v7.Instance.GetDialogueManager().DisplayMessage(DialogueManager_v2.DialogueType.HINT, dialogues, null);

        ToggleMobileUI(true);
        playerController.canMove(true);
        playerAttack.canAttack(true);

        PartitionableObject_v2 tutorialBox = null;

        while (tutorialBox == null)
        {
            tutorialBox             = block.GetComponent <PartitionableObject_v2> ();
            tutorialBox.enableClone = false;
            yield return(null);
        }

        bool tried = false;
        int  index = 0;

        while (!tutorialBox.IsTangible())
        {
            switch (index)
            {
            case 0:
                if (GameController_v7.Instance.GetPauseController().IsPaused())
                {
                    Debug.Log("IS PAUSED ENTERED");
                    enableDialogue();
                    while (GameController_v7.Instance.GetDialogueManager().IsDialogueBoxPlaying())
                    {
                        disablePlayerControls();
                        Debug.Log("DialogueManager IN");
                        yield return(null);
                    }
                    Debug.Log("DialogueManager DONE");
//					GameObject cloneObject = tutorialBox.GetComponentInChildren<PartitionedClone_v2> ().gameObject;

//					if (cloneObject != null) {
////						tutorialBox.GetComponentInChildren<HintBubbleManager> ().RemoveComponents ();
//						if (cloneObject.GetComponentInChildren<HintBubbleManager> () != null) {
//							cloneObject.GetComponentInChildren<HintBubbleManager> ().RemoveComponents ();
//						}
//					}
                    tutorialBox.enableClone = true;
                    enableDialogue();
                    while (GameController_v7.Instance.GetDialogueManager().IsDialogueBoxPlaying())
                    {
                        disablePlayerControls();
                        yield return(null);
                    }

                    //Hint to adjust fill
                    GameController_v7.Instance.GetDialogueManager().DisplayMessage(DialogueManager_v2.DialogueType.HINT, dialogues, null);

                    index = 1;

                    ToggleMobileUI(true);
                    playerAttack.canAttack(true);
                    playerController.canMove(true);
                }
                break;

            case 1:
                if (!GameController_v7.Instance.GetPauseController().IsPaused() && !tutorialBox.IsTangible() && !tutorialBox.IsAnimatingFill() && !tutorialBox.IsFilling())
                {
                    playerController.isInDialogue();
                    GameController_v7.Instance.GetDialogueManager().DisplayMessage(DialogueManager_v2.DialogueType.DIALOGUE, errorDialogue1, null);
                    while (GameController_v7.Instance.GetDialogueManager().IsDialogueBoxPlaying())
                    {
                        disablePlayerControls();
                        yield return(null);
                    }

                    //Error Hint
                    GameController_v7.Instance.GetDialogueManager().DisplayMessage(DialogueManager_v2.DialogueType.HINT, errorHint, null);

                    index = 2;

                    ToggleMobileUI(true);
                    playerAttack.canAttack(true);
                    playerController.canMove(false);
                }
                break;

            case 2:
                if (tried)
                {
                    if (!GameController_v7.Instance.GetPauseController().IsPaused() && !tutorialBox.IsTangible() && !tutorialBox.IsFilling() && !tutorialBox.IsAnimatingFill())
                    {
                        playerController.isInDialogue();
                        GameController_v7.Instance.GetDialogueManager().DisplayMessage(DialogueManager_v2.DialogueType.DIALOGUE, errorDialogue2, null);
                        while (GameController_v7.Instance.GetDialogueManager().IsDialogueBoxPlaying())
                        {
                            disablePlayerControls();
                            yield return(null);
                        }

                        //Error Hint
                        GameController_v7.Instance.GetDialogueManager().DisplayMessage(DialogueManager_v2.DialogueType.HINT, errorHint, null);

                        index++;
                        if (index > 2)
                        {
                            index = 2;
                        }

                        ToggleMobileUI(true);
                        playerAttack.canAttack(true);
                        playerController.canMove(true);

                        tried = false;
                    }
                }
                else if (GameController_v7.Instance.GetPauseController().IsPaused())
                {
                    tried = true;
                }
                break;
            }

            yield return(null);
        }

        StartCoroutine(ContinueNextRoom());
    }