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()); } }
// 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; } }
// 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); } } }
// 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"); } } } } }
IEnumerator loadNextLevel() { yield return(new WaitForSeconds(34.0f)); if (tryAgain.activeSelf == false) { fc.ExecuteBlock("nextLevel"); } }
// 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; } } } } }
// 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); } }
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"); } } }
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"); } }
// 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"); } }
public void unlockAchievement() { if (isAchievementUnlocked == false) { loadAchievementInfo(); isAchievementUnlocked = true; UserDataManager.instance.AddAchievement(4, true); fc.ExecuteBlock("unlockAchievement4"); } else { fc.ExecuteBlock("nextLevel"); } }
public void unlockAchievement() { if (isAchievementUnlocked == false) { isAchievementUnlocked = true; UserDataManager.instance.AddAchievement(1, true); fc.ExecuteBlock("unlockAchievement1"); UserDataManager.instance.UpdateItemsAndLevelData(); } else { fc.ExecuteBlock("nextLevel"); } }
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"); } }
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"); } } }
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); } }
// 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; } } }
// Update is called once per frame void Update() { // if the player press Esc if (Input.GetKeyDown(KeyCode.Escape)) { fc.ExecuteBlock("Return"); } }
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"); } }
void Update() { // When the player presses E inside the trigger zone, play the email. if (hasCollided == true && Input.GetKeyDown(KeyCode.E)) { flowchart.ExecuteBlock(blockToExecute); } }
void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.CompareTag("Player")) { Block targetBlock = talkchart.FindBlock("LoadScence_" + this.gameObject.name); talkchart.ExecuteBlock(targetBlock); } }
void PickUp() { if (pickUpAllowed) { AudioManager.instance.Play("Sound/pickup"); Destroy(gameObject); fc.ExecuteBlock("SunGlasses"); } }
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"); } } }
void PickUp() { if (pickUpAllowed) { base.PickUp(); //PersistentData.update(); fc.ExecuteBlock(BlockName); } }
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"); } }
public void unlockAchievement() { if (isAchievementUnlocked == false) { isAchievementUnlocked = true; UserDataManager.instance.AddAchievement(10, true); fc.ExecuteBlock("unlockAchievement10"); } }
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"); } } } }
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; } }
// 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); }
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"); } } }