Beispiel #1
0
    void GetItemMessage()
    {
        if (is_search)
        {
            Player_State.ismove = false;

            if (_itemup.item.ID == 0000)
            {
                _flowchart.ExecuteBlock("nothing");
            }
            else if (_itemup.item.ID == 1)
            {
                _flowchart.ExecuteBlock("Get_Lingshi");
                _itemup.PickUp();
                is_search = false;
            }
            else if (_itemup.item.ID > 0020)
            {
                _flowchart.SetStringVariable("classroom", _itemup.item.name);
                _flowchart.ExecuteBlock("Get_Key");
                _itemup.PickUp();
            }

            is_search = false;
        }
    }
Beispiel #2
0
 private void SubmitName(string arg0)
 {
     EventSystem.current.SetSelectedGameObject(null);
     code_input.text = "";
     if (!flowchart.GetBooleanVariable("L_R"))
     {
         if (arg0.Equals(CODE1_SOLUTION))
         {
             code1_solved = true;
             flowchart.ExecuteBlock("Feedback_Codepanel_Correct");
         }
         else
         {
             flowchart.ExecuteBlock("Feedback_Codepanel_Incorrect");
         }
     }
     else
     {
         if (arg0.Equals(CODE2_SOLUTION))
         {
             code2_solved = true;
             flowchart.ExecuteBlock("Feedback_Codepanel_Correct");
         }
         else
         {
             flowchart.ExecuteBlock("Feedback_Codepanel_Incorrect");
         }
     }
     checkAnswer();
 }
    private void OnMouseDown()
    {
        float dist = Vector3.Distance(player.position, transform.position);

        if (dist <= 30 && !isTalking)
        {
            if (!butterflyMachine.butterMachineOpen)
            {
                talkFlowchart.ExecuteBlock(talkFlowchart.FindBlock("noReaction"));
            }
            else
            {
                if (!butterflyOnSpecimen)
                {
                    butterflyChart.ExecuteBlock("goldenButterfly");
                    butterflyOnSpecimen = true;
                }
                else
                {
                    if (!purpleBasin)
                    {
                        butterflyChart.ExecuteBlock("goldenButterfly2");
                    }
                    else
                    {
                        butterflyChart.ExecuteBlock("makeButterSpecimen");
                        butterflyInSpecimen = true;
                    }
                }
            }
        }
    }
Beispiel #4
0
    public void Save()
    {
        BinaryFormatter bf   = new BinaryFormatter();                                           //creates a new binary formatter for serializing data.
        FileStream      file = File.Create(Application.persistentDataPath + "/playerInfo.dat"); //Creates a file named playerInfo.dat at the projects persistent data path.

        health = PlayerChart.GetIntegerVariable("Health");                                      //Extracts the player health value from the player flowchart.
        level  = Application.loadedLevel;                                                       //Stores the currently loaded level.

        playerX = player.transform.position.x;                                                  //Stores the player's X value as a float.
        playerY = player.transform.position.y;                                                  //Stores the player's Y value as a float.
        playerZ = player.transform.position.z;                                                  //Stores the player's Z value as a float.

        PlayerData data = new PlayerData();                                                     //Creates a new PlayerData class to store the information to be saved.

        data.health  = health;                                                                  //Stores the health value inside the PlayerData's health value.
        data.level   = level;                                                                   //Stores the current level inside the PlayerData's level value.
        data.playerX = playerX;                                                                 //Stores the player's X position inside the PlayerData's X position value.
        data.playerY = playerY;                                                                 //Stores the player's Y position inside the PlayerData's Y position value.
        data.playerZ = playerZ;                                                                 //Stores the player's Z position inside the PlayerData's Z position value.

        bf.Serialize(file, data);                                                               //Serializes and saves the PlayerData class in the playerInfo.dat file.
        file.Close();                                                                           //Closes the playerInfo.dat file.

        PlayerChart.ExecuteBlock("Saved");                                                      //Executes a fungus block which writes "saved" to a text object in the player HUD
    }
 public void OnTriggerEnter(Collider other)
 {
     if (!string.IsNullOrEmpty(EnterVolumeBlock))
     {
         levelScripting.ExecuteBlock(EnterVolumeBlock);
     }
 }
Beispiel #6
0
    private void Start()
    {
        if (!PlayerPrefs.HasKey("Dibujado"))
        {
            if (fc != null)
            {
                fc.ExecuteBlock("Intro");
                PlayerPrefs.SetInt("Dibujado", 1);
            }
        }
        else
        {
            if (fc != null)
            {
                PlayerPrefs.SetInt("Dibujado", PlayerPrefs.GetInt("Dibujado") + 1);
            }
        }

        followCamera.enabled  = false;
        zenitalCamera.enabled = true;

        cameraBrain.m_DefaultBlend = cameraDefinition;

        if (SaveAndLoad.SaveExists(DICTIONARY))
        {
            _circuitsNameDictionary = SaveAndLoad.Load <Dictionary <string, string> >(DICTIONARY);
        }
    }
Beispiel #7
0
 private void OnMouseDown()
 {
     talkFlowchart.ExecuteBlock("clickButton");
     if (cicadaLocker.cicadaOpen)
     {
         float dist = Vector3.Distance(player.position, transform.position);
         if (dist <= 30 && !isTalking)
         {
             if (zeroButton.count == 2 && sevenButton.count == 1 && threeButton.count == 1 && count == 1)
             {
                 count       += 1;
                 finalSuccess = true;
                 talkFlowchart.ExecuteBlock("finalTrapSuccess");
             }
             else if (zeroButton.count == 0 && sevenButton.count == 1 && threeButton.count == 1 && count == 0)
             {
                 count += 1;
             }
             else
             {
                 right = false;
                 talkFlowchart.ExecuteBlock("finalTrapFail");
             }
         }
     }
     else
     {
         talkFlowchart.ExecuteBlock("noReaction");
     }
 }
Beispiel #8
0
    public void TVInteract()
    {
        //playerScript.evtScript.eventNum++;
        Debug.Log("We're at event " + evtScript.eventNum);
        playerScript.playerActive = false;
        rend.material             = defaultMAT;
        tvGO.GetComponent <Collider> ().enabled = false;

        if (evtScript.eventNum == 0)
        {
            flowchart.ExecuteBlock("TV_Tick1");
            tvNum = 1;
        }
        else if (evtScript.eventNum == 1)
        {
            flowchart.ExecuteBlock("TV_Tick2");
            tvNum = 2;
        }
        else if (evtScript.eventNum == 2)
        {
            flowchart.ExecuteBlock("TV_Tick3");
            tvNum = 3;
        }
        else if (evtScript.eventNum >= 3)
        {
            tvNum = 4;
            Debug.Log("No More TV!");
            flowchart.ExecuteBlock("TV_Tick4");
        }

        done = true;
    }
Beispiel #9
0
    void Start()
    {
        level = GlobalControl.Instance.level;
        if (level == 0)
        {
            buttonList[0].enabled = false;
            buttonList[2].enabled = false;
            buttonList[3].enabled = false;

            imageList[0].sprite = blank;
            imageList[2].sprite = blank;
            imageList[3].sprite = blank;

            flowchart.ExecuteBlock("2");
        }

        else if (level == 1)
        {
            buttonList[2].enabled = false;
            buttonList[3].enabled = false;

            imageList[2].sprite = blank;
            imageList[3].sprite = blank;

            flowchart.ExecuteBlock("2");
        }

        else if (level == 2)
        {
            buttonList[3].enabled = false;

            imageList[3].sprite = blank;

            flowchart.ExecuteBlock("2");
        }

        else if (level == 3)
        {
            buttonList[0].enabled = false;

            imageList[0].sprite = blank;

            flowchart.ExecuteBlock("2");
        }

        else if (level == 4)
        {
            buttonList[0].enabled = false;
            buttonList[1].enabled = false;
            buttonList[2].enabled = false;
            buttonList[3].enabled = false;

            imageList[0].sprite = blank;
            imageList[1].sprite = blank;
            imageList[2].sprite = blank;
            imageList[3].sprite = blank;

            flowchart.ExecuteBlock("1");
        }
    }
    private void OnMouseDown()
    {
        float dist = Vector3.Distance(player.position, transform.position);

        if (dist <= 30 && !isTalking && !isChoosing)
        {
            if (!afterKitchen)
            {
                if (!girlCPart1)
                {
                    talkFlowchart.ExecuteBlock("girlCPart1");
                    girlCPart1 = true;
                }
            }
            else if (afterKitchen && !afterPart2)
            {
                if (!girlCPart2)
                {
                    talkFlowchart.ExecuteBlock("girlCPart2");
                    girlCPart2 = true;
                }
            }
            else if (afterPart2)
            {
                if (!girlCPart3)
                {
                    talkFlowchart.ExecuteBlock("girlCPart3");
                    girlCPart3 = true;
                }
            }
        }
    }
Beispiel #11
0
    public void DogHelp()
    {
        if ((dogNear == true))
        {
            flowchart.ExecuteBlock(BlockName2);
            doggo = flowchart.GetBooleanVariable("helped");
        }



        if (Input.GetMouseButtonDown(0) && (isdognear == true))
        {
            Vector2      ray = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast(ray, Vector2.zero);
            if (hit.collider != null)
            {
                if ((doggo == true) && (isdognear == true))
                {
                    Debug.Log("Dog helped!");
                    FoodImage.enabled = false;
                    //  Destroy(hit.collider.gameObject);
                    isdognear = false;
                }
            }
        }
    }
    private void OnMouseDown()
    {
        float dist = Vector3.Distance(player.position, transform.position);

        if (dist <= 15 && !isTalking)
        {
            if (!butterKeyOpen)
            {
                talkFlowchart.ExecuteBlock(talkFlowchart.FindBlock("noReaction"));
            }
            else
            {
                Block targetBlock = talkFlowchart.FindBlock(onMouseDown);
                talkFlowchart.ExecuteBlock(targetBlock);
                doorANum1.red.SetActive(false);
                doorANum1.blue.SetActive(false);
                doorANum1.green.SetActive(false);
                doorANum1.yellow.SetActive(false);
                doorANum2.red.SetActive(false);
                doorANum2.blue.SetActive(false);
                doorANum2.green.SetActive(false);
                doorANum2.yellow.SetActive(false);
                doorANum3.red.SetActive(false);
                doorANum3.blue.SetActive(false);
                doorANum3.green.SetActive(false);
                doorANum3.yellow.SetActive(false);
                doorANum4.red.SetActive(false);
                doorANum4.blue.SetActive(false);
                doorANum4.green.SetActive(false);
                doorANum4.yellow.SetActive(false);
            }
        }
    }
Beispiel #13
0
    // Update is called once per frame
    void Update()
    {
        if (isOnDialogArea)
        {
            if (Input.GetKeyDown(KeyCode.Space) && fc.GetBooleanVariable("Var") == false)
            {
                if (character.tag == "Character")
                {
                    fc.ExecuteBlock(character.GetComponent <CharDialog>().character.dialog);
                }
                else if (character.tag == "Item")
                {
                    fc.ExecuteBlock(character.GetComponent <ItemColected>().item.dialog);
                    character.GetComponent <Interact>().OnFocus();
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.I))
        {
            fc.SetBooleanVariable("Var", true);
            PlayerMove.canvas.SetActive(true);
            PlayerMove.textarea.SetActive(false);
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (PlayerMove.canvas.activeSelf)
            {
                PlayerMove.canvas.SetActive(false);
                PlayerMove.textarea.SetActive(false);
                fc.SetBooleanVariable("Var", false);
            }
        }
    }
Beispiel #14
0
    void callFlowchartBlock()
    {
        bool inEXAMornot = flowchart.GetBooleanVariable("InExam");

        if (inEXAMornot == true)
        {
            int nowproblem = flowchart.GetIntegerVariable("CurrentProblem");
            nowproblem = nowproblem - 4;
            if (nowproblem == 9)
            {
                Block target = flowchart.FindBlock("SCORE");
                flowchart.ExecuteBlock(target);
            }
            else
            {
                string targetname = "Q" + nowproblem;
                Block  target     = flowchart.FindBlock(targetname);
                flowchart.ExecuteBlock(target);
            }
        }
        else
        {
            int    ChapNum    = flowchart.GetIntegerVariable("CurrentChap");
            int    ProblemNum = flowchart.GetIntegerVariable("ChapProblem");
            string targetname = "ansFeedback" + ChapNum + "-" + ProblemNum;
            Block  target     = flowchart.FindBlock(targetname);
            flowchart.ExecuteBlock(target);
        }
    }
Beispiel #15
0
 void OnMouseEnter()
 {
     if (blockNameEnter != null)
     {
         flowchart.ExecuteBlock(blockNameEnter);
     }
 }
Beispiel #16
0
    void TimePassing()
    {
        float passingtime;

        //CurrentPatrolPoint = (Mathf.RoundToInt(CurrentPatrolPointf));
        if (!isTalking)
        {
            passingtime = Time.deltaTime; // if not  talking
            timeCount  += passingtime;
            //elapsedTime = timeCount;
        }
        else
        {
            //if talking
            passingtime = 0;
        }

        timeCountrounded = (int)timeCount;
        switch (timeCountrounded)
        {
        case 0:
            //changeok = false;
            storycheck.AllCharactersReady();
            currentTime          = TimePeriod.Morning;
            Timing.isNight       = false;
            character.spawncheck = true;
            flowchart.ExecuteBlock("Daychange");
            patroller.patrol();
            break;

        case 180:    // 60://this is in seconds. Default is 600 //180
            currentTime = TimePeriod.Afternoon;
            flowchart.ExecuteBlock("Daychange");
            patroller.patrol();
            break;

        case 360:    // 120://this is in seconds. Default is 1200 //360
            currentTime    = TimePeriod.Evening;
            Timing.isNight = true;
            flowchart.ExecuteBlock("Daychange");
            patroller.patrol();
            break;

        case 540:                         // 180://this is in seconds. Default is 1800 //540
            currentTime          = TimePeriod.Night;
            character.spawncheck = false; //this is for registering how long it'll take for something to spawn back
            flowchart.ExecuteBlock("Daychange");
            patroller.patrol();
            break;

        case 720:    // 240://this is in seconds. Default is 2400 //720
            if (Timing.CurrentDay == manageTime.day.Sunday)
            {
                CurrentPatrolPoint = 0;
            }
            Timing.dayRegister();
            timeCount = 0;
            break;
        }
    }
Beispiel #17
0
    private void OnMouseDown()
    {
        float dist = Vector3.Distance(player.transform.position, transform.position);

        if (tanglangGetting.gettingTanglang && dist <= 30 && !isTalking)
        {
            tanglangGetting.gettingTanglang = false;
            tanglangGetting.canGetThis      = false;
            tanglangGetting.tanglang.GetComponent <Rigidbody>().useGravity       = true;
            tanglangGetting.tanglang.GetComponent <Rigidbody>().isKinematic      = false;
            tanglangGetting.tanglang.GetComponent <Rigidbody>().detectCollisions = true;
            tanglangGetting.tanglang.transform.SetParent(null, true);
            talkFlowchart.ExecuteBlock("tanglangBite");
        }
        else if (!tanglangGetting.gettingTanglang && dist <= 30 && !isTalking)
        {
            if (!elecOpen.isLight)
            {
                talkFlowchart.ExecuteBlock("noTouch");
            }
            else
            {
                talkFlowchart.ExecuteBlock("thisIsSpider");
            }
        }
    }
Beispiel #18
0
    void Intro()
    {
        Debug.Log("Intro is called from Main");

        if (!PlayerPrefs.HasKey("Initialized"))
        {
            Debug.Log("No Initialized Key found Main");

            if (!PlayerPrefs.HasKey("QuitByChoice"))
            {
                Debug.Log("No Quitting by choice Main");
                MainChart.ExecuteBlock("Intro");
            }
            else if (PlayerPrefs.HasKey("QuitByChoice"))
            {
                Debug.Log("Quit by choice Main");
                MainChart.ExecuteBlock("Returner"); //change back before build
            }
        }
        else
        {
            Debug.Log("Found Initialized Key");
            MainChart.ExecuteBlock("Initializing");
            LoadPlayerData();
        }
    }
Beispiel #19
0
 public void ClearRule()
 {
     if (PanelRule.activeSelf)
     {
         PanelRule.SetActive(false);
         flowchart.ExecuteBlock("自分のターン");
     }
 }
Beispiel #20
0
 public void PlayVoice()
 {
     flow.ExecuteBlock("Game");
     closeSelect.SetActive(false);
     closeGame.SetActive(true);
     //btns.SetActive(false);
     am.PlayAudioDescription(audioName);
 }
Beispiel #21
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject == player && foundLeaf)
     {
         flowchart1.ExecuteBlock("Dialogue1");
         flowchart1.SetBooleanVariable("FirstTalk", true);
     }
 }
Beispiel #22
0
 IEnumerator PlayStartDialog()
 {
     flowchart.ExecuteBlock("StartDialog");
     while (flowchart.HasExecutingBlocks())
     {
         yield return(new WaitForSeconds(0.3f));
     }
     yield return(null);
 }
Beispiel #23
0
 private void StopAllBlock()
 {
     if (flowchart == null)
     {
         return;
     }
     flowchart.StopAllBlocks();
     flowchart.ExecuteBlock("GameOver");
 }
Beispiel #24
0
 public void Reset()
 {
     _questionIndex  = 0;
     _dollStateIndex = -1;
     initDic();
     SummaryWindow.ReSet();
     Flowchart.SetBooleanVariable("testFinish", false);
     Flowchart.ExecuteBlock("Reset");
 }
Beispiel #25
0
 public void PushButtonCupcake()
 {
     flowchart.ExecuteBlock("Cupcake");
     buttonCupcake1.SetActive(false);
     buttonCupcake2.SetActive(false);
     buttonCupcake3.SetActive(false);
     buttonCupcake4.SetActive(false);
     imageCupcake.SetActive(false);
     buttonCupcakesmall.SetActive(true);
 }
Beispiel #26
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         string targetname  = this.gameObject.name;
         Block  targetBlock = flowchart.FindBlock(targetname);
         flowchart.ExecuteBlock(targetBlock);
         flowchart.ExecuteBlock("Talking");
     }
 }
Beispiel #27
0
    private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        if (currentState == "")
        {
            SaveMenuState();
            print("Current State: " + currentState + ". (Got from default value)");
        }
        else
        {
            currentState = PlayerPrefs.GetString(stateKey, menuState);
            print("Current State: " + currentState + ".");
        }

        print("Entering switch statement. CurrentState: " + currentState + ".");
        switch (currentState)
        {
        case mapState:
            if (mapFlowchart)
            {
                mapFlowchart.ExecuteBlock(mapFlowchartStartBlock);
            }
            break;

        case menuState:
            if (menuFlowchart)
            {
                menuFlowchart.ExecuteBlock(menuFlowchartStartBlock);
            }
            break;

        case gameState:
            if (lastState != gameState)
            {
                if (gameFlowchart)
                {
                    gameFlowchart.ExecuteBlock(gameFlowchartStartBlock);
                }
            }
            else
            {
                if (gameFlowchart)
                {
                    gameFlowchart.ExecuteBlock(gameFlowchartContinueBlock);
                }
            }
            break;

        case playAgainState:
            if (playAgainFlowchart)
            {
                playAgainFlowchart.ExecuteBlock(playAgainFlowchartStartBlock);
            }
            break;
        }
    }
Beispiel #28
0
    public void CheckDrags()
    {
        /*foreach (DragAndDropFree item in notPlacedDragList)
         * {
         *  if (item.placed == true)
         *  {
         *      if (!placedDragList.Contains(item))
         *      {
         *          placedDragList.Add(item);
         *      }
         *      if (notPlacedDragList.Contains(item))
         *      {
         *          notPlacedDragList.Remove(item);
         *      }
         *  } else
         *  {
         *      if (!notPlacedDragList.Contains(item))
         *      {
         *          notPlacedDragList.Add(item);
         *      }
         *      if (placedDragList.Contains(item))
         *      {
         *          placedDragList.Remove(item);
         *      }
         *  }
         * }*/
        for (int i = notPlacedDragList.Count - 1; i >= 0; i--)
        {
            if (notPlacedDragList[i].placed == true)
            {
                if (!placedDragList.Contains(notPlacedDragList[i]))
                {
                    placedDragList.Add(notPlacedDragList[i]);
                }
                notPlacedDragList.RemoveAt(i);
            }
            else
            {
                if (placedDragList.Contains(notPlacedDragList[i]))
                {
                    placedDragList.RemoveAt(i);
                }
            }
        }

        if (placedDragList.Count > 0)
        {
            flowChart.ExecuteBlock(ifAnyPlacedBlockName);
        }
        else
        {
            flowChart.ExecuteBlock(ifNonePlacedBlockName);
        }
    }
    public override void StartQuest()
    {
        //Can be called by the questsystem and will start queststep 1
        if (questSystem.StartQuest(questName, questTextInitial) == false)
        {
            questStep = 1;

            //CALL FLOWCHART BLOCK ONE
            questFlowchart.ExecuteBlock(Step1BlockName);
        }
    }
Beispiel #30
0
    public bool ExecuteBlock(string blockName, Action onComplete = null)
    {
        var block = _flowchart.FindBlock(blockName);

        if (block == null)
        {
            return(false);
        }
        block.Stop();
        return(_flowchart.ExecuteBlock(block, 0, onComplete));
    }
 protected IEnumerator RunBlock(Flowchart flowchart, Block targetBlock, int commandIndex, float delay)
 {
     yield return new WaitForSeconds(delay);
     flowchart.ExecuteBlock(targetBlock, commandIndex);
 }