Ejemplo n.º 1
0
    IEnumerator PlayerAttack()
    {
        playerAttackState = PlayerAttackInProgress.YES;         // update state; the player is currently in an attack

        dialogueText.text = "Rockett shoves Nicole!";

        yield return(new WaitForSeconds(1f));

        bool isDead = enemyUnit.TakeDamage(playerUnit.damage);

        enemyHUD.SetHP(enemyUnit.currentHP);

        flowchart.ExecuteBlock("PunchEnemy");

        yield return(new WaitForSeconds(1f));

        dialogueText.text = "Nicole staggers backwards!";

        yield return(new WaitForSeconds(2f));

        Debug.Log(state);

        if (isDead)
        {
            state = BattleState.WON;
            EndBattle();
        }
        else
        {
            playerAttackState = PlayerAttackInProgress.NO;             // the player's attack is finished
            state             = BattleState.ENEMYTURN;
            StartCoroutine(EnemyTurn());
        }
    }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     // if player presses E, show the piper's dialog or enter the next level
     if (Input.GetKeyDown(KeyCode.E))
     {
         // make sure the player dosen't activate the exit panel
         if (exit.activeSelf == false)
         {
             // check if the player wannts to enter the next level
             if (nextIcon.activeSelf == true)
             {
                 fc.ExecuteBlock("nextLevel");
             }
             // then the player can active the piper's dialog
             else
             {
                 fc.ExecuteBlock("Dialog");
             }
         }
     }
     // if player presses M, solve the piper's puzzle
     else if (Input.GetKeyDown(KeyCode.M))
     {
         anim.SetTrigger("Clam");
         fc.ExecuteBlock("StopMusic");
         bc.enabled = false;
     }
 }
Ejemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.E))
     {
         if (exit.activeSelf == false)                // make sure player dosen't active exit panel
         {
             if (doorE.activeSelf == true)            // if player enters door collider
             {
                 fc.ExecuteBlock("Dialog");
             }
             else if (nextE.activeSelf == true)                     // if player enters nextLevel collider
             {
                 fc.ExecuteBlock("nextLevel");
             }
         }
     }
     else if (Input.GetKeyDown(KeyCode.Return))             // if player wants to reload
     {
         if (exit.activeSelf == false && tryAgain.activeSelf == true)
         {
             Scene s = SceneManager.GetActiveScene();
             SceneManager.LoadScene(s.name);
         }
     }
 }
Ejemplo n.º 4
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.E))
     {
         // make sure the player dosen't activate the exit panel
         if (exit.activeSelf == false)
         {
             // check if the player wannts to enter the next level
             if (nextIcon.activeSelf == true)
             {
                 fc.ExecuteBlock("nextLevel");
             }
             // then the player can active the piper's dialog
             else
             {
                 if (hasPearl == "T")                     // if player has pearl
                 {
                     Cheer();
                 }
                 else
                 {
                     fc.ExecuteBlock("Dialog");
                 }
             }
         }
     }
 }
Ejemplo n.º 5
0
    IEnumerator loadNextLevel()
    {
        yield return(new WaitForSeconds(34.0f));

        if (tryAgain.activeSelf == false)
        {
            fc.ExecuteBlock("nextLevel");
        }
    }
Ejemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.E) && exit.activeSelf == false)
        {
            if (nextText.activeSelf == true)
            {
                fc.ExecuteBlock("nextLevel");
            }
            else
            {
                if (colliderName == "PreviousLevel")                  // if player colliders with the previous level
                {
                    fc.ExecuteBlock("previousLevel");
                }

                else if (colliderName == "Eye")                       // if player colliders with the eye
                {
                    fc.ExecuteBlock("eyeLevel");
                }

                else if (colliderName == "Machine")             // if player colliders with the machine
                {
                    if (state == 1)                             // state 1: machine produces none
                    {
                        machineAnim.SetTrigger("None");
                    }
                    else if (state == 2)                        // state 2: machine produces one ticket
                    {
                        machineAnim.SetTrigger("Ticket");
                        fc.ExecuteBlock("Ticket");
                        state = 3;
                    }
                    else if (state == 3)                        // state 3: machine produces none, wait for another 10 times
                    {
                        pressMachineTimes++;
                        if (pressMachineTimes == 10 && pearl.activeSelf == false)                             // enter state 4
                        {
                            machineAnim.SetTrigger("None");
                            state = 4;
                        }
                        else
                        {
                            machineAnim.SetTrigger("None");
                        }
                    }
                    else if (state == 4)                        // state 4: machine produces one pearl
                    {
                        machineAnim.SetTrigger("Pearl");
                        fc.ExecuteBlock("Pearl");
                        UserDataManager.instance.activePearl();
                        state = 1;
                    }
                }
            }
        }
    }
Ejemplo n.º 7
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.E))
     {
         if (isEActive == true)
         {
             if (currentState == "Achievements")                              // if the player active the achievement base
             {
                 fc.ExecuteBlock("Achievements");
             }
             else if (currentState == "Exit")                                 // if the player active the exit base
             {
                 Application.Quit();
             }
             else if (currentState == "Clear")                                // if the player active the clear base
             {
                 clearPanel.SetActive(!clearPanel.activeSelf);
             }
             else if (currentState == "Credit")                               // if player active the credit base
             {
                 fc.ExecuteBlock("Credit");
             }
             else                                                             // if the player active the start base
             {
                 level.SetActive(!level.activeSelf);
             }
         }
     }
     else if (Input.GetKeyDown(KeyCode.F))                            // if player selects the next level
     {
         if (level.activeSelf == true)
         {
             chooseLevel();
         }
     }
     else if (Input.GetKeyDown(KeyCode.Return))                       // if player enters the cuurrent level
     {
         if (level.activeSelf == true && im.sprite.name != "UI-3_1")
         {
             enterLevel();
         }
     }
     else if (Input.GetKeyDown(KeyCode.Y))                            // if player wants to clear all data
     {
         if (clearPanel.activeSelf == true)
         {
             clearData();
         }
     }
     else if (Input.GetKeyDown(KeyCode.N))                            // if player dosen't want to clear any data
     {
         clearPanel.SetActive(false);
     }
 }
Ejemplo n.º 8
0
 public virtual void OnTriggerStay(Collider other)
 {
     if (other.tag == "Player")
     {
         if (Player.instance.PlayerInControl == true && (Player.instance.Direction == direction) && (InputManager.AButton))
         {
             Debug.Log("Invoke attempt");
             Interaction.ExecuteBlock("Start");
             Debug.Log("Call Attempt");
         }
     }
 }
Ejemplo n.º 9
0
 void OnTriggerEnter2D(Collider2D other)
 {
     // if  player enters the normal level zone
     if (other.gameObject.name == "nextLevel")
     {
         Camera.main.GetComponent <CameraScroll> ().enabled = false;
         fc.ExecuteBlock("nextLevel");
     }
     else if (other.gameObject.name == "safePlace")
     {
         fc.ExecuteBlock("showTentacle");
     }
 }
Ejemplo n.º 10
0
    // Update is called once per frame
    void OnCollisionEnter(UnityEngine.Collision collision)
    {
        if (collision.gameObject.tag == "Warren")
        {
            Debug.Log("hit warren");
            myFlowchart.ExecuteBlock("Warren Buy Encounter");
        }

        if (collision.gameObject.tag == "Kelly")
        {
            Debug.Log("hit kelly");
            myFlowchart.ExecuteBlock("Kelly Problem");
        }
    }
    // Update is called once per frame
    void OnCollisionEnter(UnityEngine.Collision collision)
    {
        if (collision.gameObject.tag == "Meg")
        {
            Debug.Log("hit meg");
            myFlowchart.ExecuteBlock("Meg Convo 1");
        }

        if (collision.gameObject.tag == "Kelly")
        {
            Debug.Log("hit kelly");
            myFlowchart.ExecuteBlock("Kelly Problem");
        }
    }
Ejemplo n.º 12
0
 public void unlockAchievement()
 {
     if (isAchievementUnlocked == false)
     {
         loadAchievementInfo();
         isAchievementUnlocked = true;
         UserDataManager.instance.AddAchievement(4, true);
         fc.ExecuteBlock("unlockAchievement4");
     }
     else
     {
         fc.ExecuteBlock("nextLevel");
     }
 }
Ejemplo n.º 13
0
 public void unlockAchievement()
 {
     if (isAchievementUnlocked == false)
     {
         isAchievementUnlocked = true;
         UserDataManager.instance.AddAchievement(1, true);
         fc.ExecuteBlock("unlockAchievement1");
         UserDataManager.instance.UpdateItemsAndLevelData();
     }
     else
     {
         fc.ExecuteBlock("nextLevel");
     }
 }
Ejemplo n.º 14
0
        public void ClickMachine()
        {
            int ClickTime = PlayerPrefs.GetInt("MachineClickTime");

            if (ClickTime == 0)
            {
                flowchart.ExecuteBlock("Machine_1");
                EventManager.TriggerEvent("MACHINECLICKED_1");
            }
            else if (ClickTime == 1)
            {
                EventManager.TriggerEvent("MACHINECONTROLSHOW");
                flowchart.ExecuteBlock("Machine_2");
            }
        }
Ejemplo n.º 15
0
 void OnTriggerEnter2D(Collider2D other)
 {
     // if the player has ticket
     if (other.gameObject.tag == "Player")
     {
         if (ticket.activeSelf == true)
         {
             fc.ExecuteBlock("pass");
         }
         else
         {
             fc.ExecuteBlock("Dialog");
         }
     }
 }
Ejemplo n.º 16
0
    void TaskOnClick()
    {
        if (dropdown.value == 0)
        {
            playerGender = "nonbinary";
        }
        else if (dropdown.value == 1)
        {
            playerGender = "female";
        }
        else
        {
            playerGender = "male";
        }

        if (inputField.text != "")   //make sure it's not empty
        {
            name = flowchart.GetStringVariable("playerName");
            flowchart.SetStringVariable("playerName", inputField.text);
            //gender = flowchart.GetStringVariable("playerGender");
            //flowchart.SetStringVariable("playerGender", playerGender);

            flowchart.ExecuteBlock("Wake Up");
            Destroy(transform.gameObject.GetComponentInParent <Canvas>().gameObject);
        }
    }
Ejemplo n.º 17
0
    // Update is called once per frame
    void Update()
    {
        if (showSystemChat && !switchingMaps)
        {
            showSystemChat = false;
            systemChatUp   = true;
            systemChat.ExecuteBlock("SystemChat");
            playerController.canAct = false;
        }

        if (switchingMaps)
        {
            if (oldMapUnloaded && newMapLoaded)
            {
                //all done, so player can move
                SceneManager.SetActiveScene(currentMap);
                playerController.canAct = true;
                switchingMaps           = false;
            }
        }

        if (systemChatUp)
        {
            if (!systemChat.FindBlock("SystemChat").IsExecuting())
            {
                systemChatUp            = false;
                playerController.canAct = true;
            }
        }
    }
Ejemplo n.º 18
0
 // Update is called once per frame
 void Update()
 {
     // if the player press Esc
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         fc.ExecuteBlock("Return");
     }
 }
Ejemplo n.º 19
0
        public void ClickWaterButton()
        {
            int ClickTime = PlayerPrefs.GetInt("WaterButtonClickTime");

            if (ClickTime == 0)
            {
                flowchart.ExecuteBlock("Water_Null");
            }
            else if (ClickTime == 1)
            {
                flowchart.ExecuteBlock("Water_Wrong");
            }
            else if (ClickTime == 2)
            {
                flowchart.ExecuteBlock("Water_Correct");
            }
        }
Ejemplo n.º 20
0
 void Update()
 {
     // When the player presses E inside the trigger zone, play the email.
     if (hasCollided == true && Input.GetKeyDown(KeyCode.E))
     {
         flowchart.ExecuteBlock(blockToExecute);
     }
 }
Ejemplo n.º 21
0
 void OnCollisionEnter2D(Collision2D other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         Block targetBlock = talkchart.FindBlock("LoadScence_" + this.gameObject.name);
         talkchart.ExecuteBlock(targetBlock);
     }
 }
Ejemplo n.º 22
0
 void PickUp()
 {
     if (pickUpAllowed) {
         AudioManager.instance.Play("Sound/pickup");
         Destroy(gameObject);
         fc.ExecuteBlock("SunGlasses");
     }
 }
Ejemplo n.º 23
0
 public void unlockAchievement()
 {
     // if player is still in level 1
     if (SceneManager.GetActiveScene().name == "Level-1")
     {
         // check if needs to unlock Achievement 5
         if (isAchievementUnlocked == false)
         {
             isAchievementUnlocked = true;
             UserDataManager.instance.AddAchievement(5, true);
             fc.ExecuteBlock("unlockAchievement5");
         }
         else
         {
             fc.ExecuteBlock("toCredit");
         }
     }
 }
Ejemplo n.º 24
0
 void PickUp()
 {
     if (pickUpAllowed)
     {
         base.PickUp();
         //PersistentData.update();
         fc.ExecuteBlock(BlockName);
     }
 }
Ejemplo n.º 25
0
 void Update()
 {
     // if the play press E when E icon appears
     if (Input.GetKeyDown(KeyCode.E) && Ebutton.activeSelf == true)
     {
         anim.SetTrigger("TouchGirl");
         fc.ExecuteBlock("nextLevel");
     }
 }
Ejemplo n.º 26
0
 public void unlockAchievement()
 {
     if (isAchievementUnlocked == false)
     {
         isAchievementUnlocked = true;
         UserDataManager.instance.AddAchievement(10, true);
         fc.ExecuteBlock("unlockAchievement10");
     }
 }
Ejemplo n.º 27
0
    public GameObject nextText, exit;         // referencce to the next level text, exit panel

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            if (exit.activeSelf == false)
            {
                if (tabletImg.activeSelf == true)
                {
                    tablet.GetComponent <TabletControl> ().enabled = false;
                    fc.ExecuteBlock("Pick");
                    UserDataManager.instance.activeCow();
                }
                else if (nextText.activeSelf == true)
                {
                    fc.ExecuteBlock("nextLevel");
                }
            }
        }
    }
Ejemplo n.º 28
0
    private int stayTime = 0;               // the total time the player has stayed on

    // Update is called once per frame
    void Update()
    {
        if (stayTime == 30)
        {
            CancelInvoke();
            player.enabled = false;
            fc.ExecuteBlock("hiddenLevel");
            stayTime = 0;
        }
    }
Ejemplo n.º 29
0
    // Start is called before the first frame update
    void Start()
    {
        sceneController = FindObjectOfType <SceneController>();

        if (flowchart == null && flowchartName != null && flowchartName.Trim().Length != 0)
        {
            flowchart = GameObject.Find(flowchartName).GetComponent <Fungus.Flowchart>();
        }

        flowchart.ExecuteBlock(blockName);
    }
Ejemplo n.º 30
0
    public GameObject text, exit, tryAgain;       // reference to the text, exit, tryAgain GameObject

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            // make sure the tryAgain, exit panel are off and the player enter the boat zone
            if (exit.activeSelf == false && tryAgain.activeSelf == false && text.activeSelf == true)
            {
                fc.ExecuteBlock("nextLevel");
            }
        }
    }