Beispiel #1
0
        private void Update()
        {
            if (control != null)
            {
                if (control.HasExecutingBlocks() == true)
                {
                    isTalking = true;
                }
                else
                {
                    isTalking = false;
                }
            }
            else
            {
                isTalking = false;
            }



            if (isUseful)
            {
                if (activeAuto == true)
                {
                    ActiveFlowchart();
                }
                else
                {
                    if (Input.GetKeyUp(key))
                    {
                        ActiveFlowchart();
                    }
                }
            }
        }
Beispiel #2
0
 private void OnMouseDown()
 {
     if (!flowchart.HasExecutingBlocks())
     {
         flowchart.ExecuteBlock("First");
     }
 }
Beispiel #3
0
 //used when some character wants to perform dialog
 public static bool ClaimDialog(Flowchart flowchart)
 {
     if (flowchart.HasExecutingBlocks() || performingDialog == true)
     {
         return(false);
     }
     performingDialog = true;
     return(true);
 }
Beispiel #4
0
 IEnumerator FinishPuzzle()
 {
     flowchart.ExecuteBlock("FinishedPuzzle");
     while (flowchart.HasExecutingBlocks())
     {
         yield return(new WaitForSeconds(0.3f));
     }
     TearDownScene();
     ReturnToLibrary();
 }
Beispiel #5
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         if (!fc.HasExecutingBlocks())
         {
             fc.ExecuteBlock("Start");
         }
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (!fungus.HasExecutingBlocks())
     {
         for (int i = 0; i < UiElementos.Length; i++)
         {
             UiElementos[i].SetActive(true);
             print("Entrou");
             liberarJogo = true;
         }
     }
 }
Beispiel #7
0
 // Update is called once per frame
 void Update()
 {
     if (flowchart.HasExecutingBlocks())
     {
         speed = 0f;
     }
     else
     {
         speed = baseSpeed;
     }
     move();
     checkHealth();
     checkMana();
 }
Beispiel #8
0
    // Update is called once per frame
    void Update()
    {
        if (chat_progress >= chat_max)
        {
            chat_progress = chat_max;
        }

        if (!myflowchart.HasExecutingBlocks())
        {
            if (Input.GetKeyDown(KeyCode.E) && myflowchart.GetBooleanVariable("player_in_range") == true)
            {
                myflowchart.ExecuteBlock(stringname + chat_progress);
                chat_progress += 1;
            }
        }
    }
Beispiel #9
0
    void Update()
    {
        if (flowchart == null)
        {
            flowchart = MissionSetting.FlowerChart;
        }
        contentObj.transform.position = new Vector3(contentObj.transform.position.x, Mathf.Clamp(contentObj.transform.position.y, contentTop, contentBottom), contentObj.transform.position.z);

        if (flowchart != null && flowchart.HasExecutingBlocks())
        {
            allBlocks   = flowchart.GetExecutingBlocks();
            lastCommand = allBlocks [allBlocks.Count - 1].ActiveCommand;
            setLastText();
        }

        /*if (Input.GetKeyDown (KeyCode.D)) {
         *      showDialog ();
         * }*/
    }
Beispiel #10
0
    void Update()
    {
#if UNITY_EDITOR
        if (Input.GetKeyUp(KeyCode.LeftShift) || Input.GetKeyUp(KeyCode.RightShift))
        {
            SetLevel((int)Mathf.Repeat(_currentLevel + 1, levels.Length));
        }
#endif

        if (_currentFlowchart != null)
        {
            bool executing = _currentFlowchart.HasExecutingBlocks();
            if (_executingBlock != executing)
            {
                _executingBlock = executing;
                foreach (var clickable in clickables)
                {
                    clickable.enabled = !_executingBlock;
                }
            }
        }
    }
    public void SetFungusParameter(Flowchart flowchart)
    {
        switch (buttonType)
        {
        case ButtonType.RightButton:

            if (flowchart.HasExecutingBlocks())
            {
                flowchart.SetGameObjectVariable("rightButton", this.gameObject);
            }
            else
            {
                flowchart.SetGameObjectVariable("rightButton", this.gameObject);
                flowchart.ExecuteBlock("Right Button");
            }

            break;

        case ButtonType.WrongButton:
            flowchart.SetGameObjectVariable("wrongButton", this.gameObject);
            flowchart.ExecuteBlock("Wrong Button");
            break;
        }
    }
Beispiel #12
0
    private void FixedUpdate()
    {
        //if player object is not close to the target already
        //return the object clicked
        //move the player there
        //if player object is close, interact with it
        if (!flowchart.HasExecutingBlocks())
        {
            if (Input.GetMouseButtonDown(0))
            {
                RaycastHit hit;
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                if (Physics.Raycast(ray, out hit))
                {
                    if (hit.rigidbody != null)
                    {
                        if (hit.collider.tag == "moveEnabled")
                        {
                            moveTarget.transform.position = hit.point;
                        }
                        else if (hit.collider.tag == "clue")
                        {
                            if (Vector3.Distance(gameObject.transform.position, hit.transform.position) < 4f)
                            {
                                string name = hit.collider.name;
                                Debug.Log("you examined the " + name);
                                switch (name)
                                {
                                case "Briefcase":
                                    flowchart.ExecuteBlock("Finding-the-Suitcase");
                                    break;

                                default:
                                    Debug.LogWarning("You didn't set up this object yet!");
                                    break;
                                }
                            }
                            else
                            {
                                moveTarget.transform.position = hit.transform.position;
                            }
                        }
                        else if (hit.collider.tag == "door")
                        {
                            if (Vector3.Distance(gameObject.transform.position, hit.transform.position) < 3f)
                            {
                                doorStuff = hit.collider.gameObject.GetComponent <doorScript>();

                                if (fade != null)
                                {
                                    StartCoroutine(fade.Fade(false, doorStuff.sceneNumberToLoad));
                                }
                                else
                                {
                                    Debug.LogWarning("No fade UI in the scene!");
                                    SceneManager.LoadScene(doorStuff.sceneNumberToLoad);
                                }
                            }
                            else
                            {
                                moveTarget.transform.position = hit.transform.position;
                            }
                        }
                    }
                }
            }

            playerAgent.destination = moveTarget.position;
        }
    }
Beispiel #13
0
    // Update is called once per frame
    void Update()
    {
        if (flowchart.HasExecutingBlocks())
        {
            speed   = 0;
            talking = 1;
        }
        else
        {
            speed   = baseSpeed;
            talking = 0;
        }
        //if (!flowchart.HasExecutingBlocks())
        //{
        checkHealth();
        checkMana();
        GameObject  ball      = GameObject.Find("Ball");
        Rigidbody2D ball_body = ball.GetComponent <Rigidbody2D>();
        float       diff      = 0.2f;

        // ball is static
        if (ball_body.velocity.x == 0)
        {
            // need to be launched
            if (ball.transform.position.x > 0)
            {
                float   deltax   = speed * Time.deltaTime;
                Vector2 movement = new Vector2(-deltax, 0);
                _body.velocity = movement;
            }
            else
            {
                _body.velocity = new Vector2(0, 0);
            }
        }
        // ball is higher than AI
        else if (ball.transform.position.y > transform.position.y + diff)
        {
            float deltaY = speed * Time.deltaTime;
            float deltaX = 0;
            if (speed != 0)
            {
                deltaX = ball_body.velocity.x * 0.2f;
            }

            if (transform.position.x > 14.5f && ball_body.velocity.x > 0)
            {
                _body.velocity = new Vector2(0, deltaY);
            }
            else
            {
                _body.velocity = new Vector2(deltaX * 0.2f, deltaY);
            }
        }
        // ball is lower than AI
        else if (ball.transform.position.y < transform.position.y - diff)
        {
            float deltaX = 0;
            if (speed != 0)
            {
                deltaX = ball_body.velocity.x * 0.2f;
            }
            float deltaY = speed * Time.deltaTime;
            if (transform.position.x > 14.5f && ball_body.velocity.x > 0)
            {
                _body.velocity = new Vector2(0, -deltaY);
            }
            else
            {
                _body.velocity = new Vector2(deltaX * 0.2f, -deltaY);
            }
        }
        else
        {
            _body.velocity = new Vector2(0, 0);
        }
        // }
    }
Beispiel #14
0
    public void OnClick(GameObject clickedObject)
    {
        // if we're not talking to anyone
        if (currentFlowchart == null || currentPersona == null)
        {
            // are we walking?
            if (IsWalking)
            {
                StopWalking();
            }
            return;
        }

        // if we currently have a menuDialog active
        if (transform.FindChild("Dialogues/Player_MenuDialog").gameObject.activeSelf)
        {
            return;
        }

        // ok, we do NOT have a menuDialog active

        // if there is no current dialogue
        if (!currentFlowchart.HasExecutingBlocks())
        {
            // if we're still in collision with a Persona
            if (currentPersona != null)
            {
                // try to force restart that previous dialogue
                TryToStartFlowchart(currentPersona);
            }
            // whatever the case, leave this method
            return;
        }

        List <GameObject> charactersInFlowchart = GetCharactersInFlowchart(currentFlowchart);

        // if the clicked object isn't even in the current dialog
        if (!charactersInFlowchart.Contains(clickedObject) && clickedObject != null)
        {
            Debug.LogWarning("Character " + GetPath(this.gameObject.transform) + " isn't in flowchart " + currentFlowchart.name);
            return;
        }

        // go through each persona we're potentially talking to
        foreach (GameObject characterObject in charactersInFlowchart)
        {
            // make sure that object isn't us
//			if (characterObject.name == this.gameObject.name) {
//				continue;
//			}
            // get the path to their SayDialog
            SayDialog personaSayDialog = characterObject.GetComponentInChildren <SayDialog>();
            // if this dialog is actually something
            if (personaSayDialog != null)
            {
                // check to see if that dialog object is active
                if (personaSayDialog.gameObject.activeSelf)
                {
                    // ok, push dat button!
                    personaSayDialog.continueButton.onClick.Invoke();
                    // all done
                    return;
                }
            }
        }
    }
Beispiel #15
0
    void FixedUpdate()
    {
        if (MissionTargets.Find((x) => x.gameObject == null) == null && MissionTargets.IndexOf(MissionTargets.Find((x) => x.gameObject == null)) != -1)
        {
            MissionArrows.RemoveAt(MissionTargets.IndexOf(MissionTargets.Find((x) => x.gameObject == null)));
            MissionTargets.RemoveAt(MissionTargets.IndexOf(MissionTargets.Find((x) => x.gameObject == null)));
        }


        if (Global.LevelEnd == null)
        {
            Global.LevelEnd = GameObject.Find("Bool_LevelEnd");
        }

        if (FlowerChart != null)
        {
            if (Global.Level == "1")
            {
                if (Vector3.Distance(Global.Player.transform.position, Rose.transform.position) <= 1.2f && FlowerChart.GetBooleanVariable("GetBread"))
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("GiveBread");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else if (Vector3.Distance(Global.Player.transform.position, Shop_Door2.transform.position) <= 1.2f && FlowerChart.GetBooleanVariable("Bread"))
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("BuyBread");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else if (Vector3.Distance(Global.Player.transform.position, GlassRepair.transform.position) <= 1.2f && FlowerChart.GetBooleanVariable("FindGP"))
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("FindGP");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else if (Vector3.Distance(Global.Player.transform.position, PrinceHome_Door.transform.position) <= 1.2f && FlowerChart.GetBooleanVariable("GiveBread"))
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("RoseGoHome");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else if (Vector3.Distance(Global.Player.transform.position, PrinceHome_Door.transform.position) <= 1.2f && FlowerChart.GetBooleanVariable("SecGoHome"))
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("SecGoHome");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else if (Vector3.Distance(Global.Player.transform.position, MtShip1.transform.position) <= 1.2f && FlowerChart.GetBooleanVariable("Ship"))
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("GoShip");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else if (Vector3.Distance(Global.Player.transform.position, Marley.transform.position) <= 1.2f)
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("MarletTalk");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else if (Vector3.Distance(Global.Player.transform.position, AnotherHouse_Door2.transform.position) <= 1.2f)
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("HouseTalk");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else if (Vector3.Distance(Global.Player.transform.position, WareHouse_Door.transform.position) <= 1.2f)
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("WareHouseTalk");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else
                {
                    PlayerStatusImage.GetStatus("None");
                }
            }

            if (Global.Level == "2")
            {
                // Landing
                if (MissionSetting.FlowerChart.GetBooleanVariable("Landing") && PlayerBody != null)
                {
                    SpaceShip.transform.position = Vector3.MoveTowards(SpaceShip.transform.position, new Vector3(SpaceShip.transform.position.x, Global.Player.transform.position.y, SpaceShip.transform.position.z), 0.025f);
                    if (Mathf.Abs(SpaceShip.transform.position.y - Global.Player.transform.position.y) < 0.05f)
                    {
                        for (int i = 0; i < PlayerBody.transform.childCount; i++)
                        {
                            PlayerBody.transform.GetChild(i).gameObject.GetComponent <Renderer> ().enabled = true;
                            PlayerBody.transform.GetChild(i).gameObject.GetComponent <FadeObject> ().PlayerFadeIn();
                        }
                        if (PlayerBody.transform.GetChild(0).gameObject.GetComponent <Renderer>().material.color.a >= 0.5f && this.GetComponent <PathController>().BeTouchedFloor == null)
                        {
                            this.GetComponent <PathController> ().WalkOrder("V3Floor_10");
                        }
                    }
                }

                if (Vector3.Distance(Global.Player.transform.position, Lucas.transform.position) <= 1.2f)
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("LucasTalk01");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else if (Vector3.Distance(Global.Player.transform.position, Sisco.transform.position) <= 1.2f)
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("SiscoTalk01");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else if (Vector3.Distance(Global.Player.transform.position, Riven.transform.position) <= 1.2f)
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("RivenTalk01");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else if (Vector3.Distance(Global.Player.transform.position, Soyna.transform.position) <= 1.2f)
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("SoynaTalk01");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else if (Vector3.Distance(Global.Player.transform.position, Mike.transform.position) <= 1.2f)
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("MikeTalk01");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else if (Vector3.Distance(Global.Player.transform.position, Bill.transform.position) <= 1.2f)
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("BillTalk01");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else
                {
                    PlayerStatusImage.GetStatus("None");
                }


                // Exit Planet
                if (FlowerChart.GetBooleanVariable("PushBox01") && FlowerChart.GetBooleanVariable("FindLeaf") && FlowerChart.GetBooleanVariable("FindEngine") && FlowerChart.GetBooleanVariable("FindKyder") && FlowerChart.GetBooleanVariable("Start"))
                {
                    Flowchart.BroadcastFungusMessage("GO");
                }
            }

            if (Global.Level == "3")
            {
                // Landing
                if (MissionSetting.FlowerChart.GetBooleanVariable("Landing") && PlayerBody != null)
                {
                    SpaceShip.transform.position = Vector3.Lerp(SpaceShip.transform.position, new Vector3(SpaceShip.transform.position.x, Global.Player.transform.position.y, SpaceShip.transform.position.z), 0.1f);
                    if (Mathf.Abs(SpaceShip.transform.position.y - Global.Player.transform.position.y) < 0.05f)
                    {
                        for (int i = 0; i < PlayerBody.transform.childCount; i++)
                        {
                            PlayerBody.transform.GetChild(i).gameObject.GetComponent <Renderer> ().enabled = true;
                            PlayerBody.transform.GetChild(i).gameObject.GetComponent <FadeObject> ().PlayerFadeIn();
                        }
                        if (PlayerBody.transform.GetChild(0).gameObject.GetComponent <Renderer>().material.color.a >= 0.5f && this.GetComponent <PathController>().BeTouchedFloor == null)
                        {
                            this.GetComponent <PathController> ().WalkOrder("V3Floor_2");
                        }
                    }
                }

                if (Vector3.Distance(Global.Player.transform.position, King.transform.position) <= 1.2f)
                {
                    // 室內場景不適用

                    /*if (!EisPressed && !FlowerChart.HasExecutingBlocks()) {
                     *      PlayerStatusImage.GetStatus ("Interact?");
                     * }
                     * if (Input.GetKeyDown (KeyCode.E)) {
                     *      Flowchart.BroadcastFungusMessage ("FirstTouchKing");
                     *      PlayerStatusImage.GetStatus ("None");
                     *      EisPressed = true;
                     * }*/
                }
                else if (Vector3.Distance(Global.Player.transform.position, HouseKeeper.transform.position) <= 1.2f)
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("HouseKeeper");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else if (Vector3.Distance(Global.Player.transform.position, Warehouse2.transform.position) <= 1.2f)
                {
                    if (!EisPressed && !FlowerChart.HasExecutingBlocks())
                    {
                        PlayerStatusImage.GetStatus("Interact?");
                    }
                    if (Input.GetKeyDown(KeyCode.E))
                    {
                        Flowchart.BroadcastFungusMessage("Warehouse2");
                        PlayerStatusImage.GetStatus("None");
                        EisPressed = true;
                    }
                }
                else
                {
                    PlayerStatusImage.GetStatus("None");
                }
            }



            switch (Blocking)
            {
            case "開頭":

                MissionTargets.Add(GameObject.Find("Event_Shop(Clone)"));
                CameraMove(GameObject.Find("Event_Shop(Clone)"), CameraController.CurrentCam, CameraController.CamTarget, new Vector3(-0.5f, 5, -0.5f), true);

                Blocking = null;
                break;

            case "買麵包":

                if (FlowerChart.GetBooleanVariable("Bread"))
                {
                    Destroy(MissionArrows [MissionTargets.LastIndexOf(GameObject.Find("Event_Shop(Clone)"))]);
                    MissionTargets.Clear();
                    MissionArrows.Clear();
                    MissionTargets.Add(GameObject.Find("Event_Rose(Clone)"));
                    CameraMove(GameObject.Find("Event_Rose(Clone)"), CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 4, 0), true);

                    Blocking = null;
                }
                break;

            case "給麵包":

                if (FlowerChart.GetBooleanVariable("GetBread"))
                {
                    Destroy(MissionArrows [MissionTargets.LastIndexOf(GameObject.Find("Event_Rose(Clone)"))]);
                    MissionTargets.Clear();
                    MissionArrows.Clear();
                    MissionTargets.Add(GameObject.Find("Event_PrinceHome(Clone)"));
                    CameraMove(GameObject.Find("Event_PrinceHome(Clone)"), CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), true);

                    Blocking = null;
                }
                break;

            case "帶玫瑰回家":

                if (FlowerChart.GetBooleanVariable("GiveBread"))
                {
                    Destroy(MissionArrows [MissionTargets.LastIndexOf(GameObject.Find("Event_PrinceHome(Clone)"))]);
                    MissionTargets.Clear();
                    MissionArrows.Clear();
                    MissionTargets.Add(GameObject.Find("Event_GlassRepair(Clone)"));
                    CameraMove(GameObject.Find("Event_GlassRepair(Clone)"), CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 1), true);

                    Blocking = null;
                }
                break;

            case "找爺爺":

                if (FlowerChart.GetBooleanVariable("FindGP"))
                {
                    Destroy(MissionArrows [MissionTargets.LastIndexOf(GameObject.Find("Event_GlassRepair(Clone)"))]);
                    MissionTargets.Clear();
                    MissionArrows.Clear();
                    MissionTargets.Add(GameObject.Find("Event_PrinceHome(Clone)"));
                    CameraMove(GameObject.Find("Event_PrinceHome(Clone)"), CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), true);

                    Blocking = null;
                }
                break;

            case "第二次回家":

                if (FlowerChart.GetBooleanVariable("SecGoHome"))
                {
                    Destroy(MissionArrows [MissionTargets.LastIndexOf(GameObject.Find("Event_PrinceHome(Clone)"))]);
                    MissionTargets.Clear();
                    MissionArrows.Clear();
                    MissionTargets.Add(GameObject.Find("Event_Mt.SpaceShip(Clone)"));
                    CameraMove(GameObject.Find("Event_Mt.SpaceShip(Clone)"), CameraController.CurrentCam, CameraController.CamTarget, new Vector3(-0.5f, 5, -1), true);

                    Blocking = null;
                }
                break;

            case "開飛船":
                if (FlowerChart.GetBooleanVariable("Ship"))
                {
                    Destroy(MissionArrows [MissionTargets.LastIndexOf(GameObject.Find("Event_Mt.SpaceShip(Clone)"))]);
                    MissionTargets.Clear();
                    MissionArrows.Clear();

                    Blocking = null;
                }
                break;


            case "開頭對話":
                if (Global.Level == "2")
                {
                    MissionTargets.Add(GameObject.Find("Event_Lucas(Clone)"));
                    MissionTargets.Add(GameObject.Find("Event_Soyna(Clone)"));
                    MissionTargets.Add(GameObject.Find("Event_Riven(Clone)"));
                    MissionTargets.Add(GameObject.Find("Event_Sisco(Clone)"));
                    CameraMove(MissionTargets [0], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), true);
                    MultiPos = new Vector3(0, 5, 0);
                    Blocking = null;
                }
                break;

            case "盧卡斯第一次對話":
                //Destroy (MissionArrows [MissionTargets.LastIndexOf (GameObject.Find ("Event_Lucas(Clone)"))]);
                //Destroy (MissionArrows.Find((x) => x.name == "Event_Lucas(Clone)_MA"));
                if (MissionTargets.Contains(GameObject.Find("Event_Lucas(Clone)")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Event_Lucas(Clone)_Arrow"))
                {
                    MissionArrows.FindLast((x) => x.name == "Event_Lucas(Clone)_Arrow").SetActive(false);
                    MissionArrows.RemoveAt(MissionTargets.LastIndexOf(GameObject.Find("Event_Lucas(Clone)")));

                    MissionTargets.Remove(GameObject.Find("Event_Lucas(Clone)"));
                }

                /*
                 * TargetID = MissionTargets.Count;
                 * MissionTargets.Add (GameObject.Find ("Box_1"));
                 * MissionTargets.Add (GameObject.Find ("Box_2"));
                 * MissionTargets.Add (GameObject.Find ("Box_3"));
                 *
                 * CameraMove (MissionTargets[TargetID], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 4, 0));*/

                if (FlowerChart.GetBooleanVariable("PushBox01") == false && FlowerChart.GetBooleanVariable("GetTool01") == false)
                {
                    if (Arrow_Lucas)
                    {
                        MissionTargets.Add(GameObject.Find("Event_IncinerationPlant(Clone)"));
                        CameraMove(MissionTargets [MissionTargets.Count - 1], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), Arrow_Lucas);
                    }
                    Arrow_Lucas = false;
                }
                Blocking = null;
                break;

            case "索依娜第一次對話":
                //Destroy (MissionArrows [MissionTargets.LastIndexOf (GameObject.Find ("Event_Soyna(Clone)"))]);
                //Destroy (MissionArrows.Find((x) => x.name == "Event_Soyna(Clone)_MA"));
                if (MissionTargets.Contains(GameObject.Find("Event_Soyna(Clone)")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Event_Soyna(Clone)_Arrow"))
                {
                    MissionArrows.FindLast((x) => x.name == "Event_Soyna(Clone)_Arrow").SetActive(false);
                    MissionArrows.RemoveAt(MissionTargets.LastIndexOf(GameObject.Find("Event_Soyna(Clone)")));

                    MissionTargets.Remove(GameObject.Find("Event_Soyna(Clone)"));
                }
                //MissionTargets.Add (GameObject.Find ("Event_Riven(Clone)"));
                //MissionTargets.Add (GameObject.Find ("Event_Station(Clone)"));
                //MissionTargets.Add (GameObject.Find ("Event_BattleShipWing(Clone)"));
                if (FlowerChart.GetBooleanVariable("FindLeaf") == false && FlowerChart.GetBooleanVariable("GetLeaf") == false)
                {
                    TargetID = MissionTargets.Count;

                    if (GameObject.Find("Redleaf_A") != null && Arrow_Soyna)
                    {
                        MissionTargets.Add(GameObject.Find("Redleaf_A"));
                    }
                    if (GameObject.Find("Redleaf_B") != null && Arrow_Soyna)
                    {
                        MissionTargets.Add(GameObject.Find("Redleaf_B"));
                    }
                    if (GameObject.Find("Redleaf_C") != null && Arrow_Soyna)
                    {
                        MissionTargets.Add(GameObject.Find("Redleaf_C"));
                    }
                    if (Arrow_Soyna)
                    {
                        CameraMove(MissionTargets [TargetID], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 1, 0), Arrow_Soyna);
                        MultiPos = new Vector3(0, 1, 0);
                    }
                    Arrow_Soyna = false;
                }

                Blocking = null;
                break;

            case "瑞文第一次對話":
                //Destroy (MissionArrows [MissionTargets.LastIndexOf (GameObject.Find ("Event_Riven(Clone)"))]);
                //Destroy (MissionArrows.Find((x) => x.name == "Event_Riven(Clone)_MA"));
                if (MissionTargets.Contains(GameObject.Find("Event_Riven(Clone)")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Event_Riven(Clone)_Arrow"))
                {
                    MissionArrows.FindLast((x) => x.name == "Event_Riven(Clone)_Arrow").SetActive(false);
                    MissionArrows.RemoveAt(MissionTargets.LastIndexOf(GameObject.Find("Event_Riven(Clone)")));

                    MissionTargets.Remove(GameObject.Find("Event_Riven(Clone)"));
                }
                if (FlowerChart.GetBooleanVariable("FindEngine") == false && FlowerChart.GetBooleanVariable("GetEngine") == false)
                {
                    if (Arrow_Riven)
                    {
                        MissionTargets.Add(GameObject.Find("Engine"));
                        CameraMove(MissionTargets [MissionTargets.Count - 1], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 1, 0), Arrow_Riven);
                    }
                    Arrow_Riven = false;
                }
                Blocking = null;
                break;

            case "西斯寇第一次對話":
                //Destroy (MissionArrows [MissionTargets.LastIndexOf (GameObject.Find ("Event_Sisco(Clone)"))]);
                //Destroy (MissionArrows.Find((x) => x.name == "Event_Sisco(Clone)_MA"));
                if (MissionTargets.Contains(GameObject.Find("Event_Sisco(Clone)")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Event_Sisco(Clone)_Arrow"))
                {
                    MissionArrows.FindLast((x) => x.name == "Event_Sisco(Clone)_Arrow").SetActive(false);
                    MissionArrows.RemoveAt(MissionTargets.LastIndexOf(GameObject.Find("Event_Sisco(Clone)")));

                    MissionTargets.Remove(GameObject.Find("Event_Sisco(Clone)"));
                }
                if (FlowerChart.GetBooleanVariable("FindKyder") == false && FlowerChart.GetBooleanVariable("GetKyder") == false)
                {
                    if (Arrow_Sisco)
                    {
                        MissionTargets.Add(GameObject.Find("Event_Station(Clone)"));
                        CameraMove(MissionTargets [MissionTargets.Count - 1], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), Arrow_Sisco);
                    }
                    Arrow_Sisco = false;
                }
                Blocking = null;
                break;

            case "控制箱子變數":

                /*if(MissionArrows.Contains(GameObject.Find(GameObject.Find ("Box_1").transform.parent.gameObject.name + "_MA")))
                 *      Destroy (MissionArrows.Find((x) => x.name == GameObject.Find ("Box_1").transform.parent.gameObject.name + "_MA"));
                 * if(MissionArrows.Contains(GameObject.Find(GameObject.Find ("Box_2").transform.parent.gameObject.name + "_MA")))
                 *      Destroy (MissionArrows.Find((x) => x.name == GameObject.Find ("Box_2").transform.parent.gameObject.name + "_MA"));
                 * if(MissionArrows.Contains(GameObject.Find(GameObject.Find ("Box_3").transform.parent.gameObject.name + "_MA")))
                 *      Destroy (MissionArrows.Find((x) => x.name == GameObject.Find ("Box_3").transform.parent.gameObject.name + "_MA"));*/
                /*MissionTargets.Remove (GameObject.Find ("Box_1"));
                *  MissionTargets.Remove (GameObject.Find ("Box_2"));
                *  MissionTargets.Remove (GameObject.Find ("Box_3"));*/
                if (MissionTargets.Contains(GameObject.Find("Event_IncinerationPlant(Clone)")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Event_IncinerationPlant(Clone)_Arrow"))
                {
                    MissionTargets.Remove(GameObject.Find("Event_IncinerationPlant(Clone)"));
                    MissionArrows.FindLast((x) => x.name == "Event_IncinerationPlant(Clone)_Arrow").SetActive(false);
                    MissionArrows.Remove(GameObject.Find("Event_IncinerationPlant(Clone)_Arrow"));
                    if (Arrow_Box)
                    {
                        MissionTargets.Add(GameObject.Find("Event_Lucas(Clone)"));
                    }
                    CameraMove(MissionTargets [MissionTargets.Count - 1], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), Arrow_Box);
                    Arrow_Box = false;
                }
                Blocking = null;
                break;

            case "控制草葉變數":
                /*if(MissionArrows.Contains(GameObject.Find ("Event_Riven(Clone)_MA")))
                 *      Destroy (MissionArrows.Find((x) => x.name == "Event_Riven(Clone)_MA"));
                 * if(MissionArrows.Contains(GameObject.Find ("Event_Station(Clone)_MA")))
                 *      Destroy (MissionArrows.Find((x) => x.name == "Event_Station(Clone)_MA"));
                 * if(MissionArrows.Contains(GameObject.Find ("Event_BattleShipWing(Clone)_MA")))
                 *      Destroy (MissionArrows.Find((x) => x.name == "Event_BattleShipWing(Clone)_MA"));*/
                if (MissionTargets.Contains(GameObject.Find("Redleaf_A")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Redleaf_A_Arrow"))
                {
                    MissionTargets.Remove(GameObject.Find("Redleaf_A"));
                    MissionArrows.FindLast((x) => x.name == "Redleaf_A_Arrow").SetActive(false);
                    MissionArrows.Remove(GameObject.Find("Redleaf_A_Arrow"));
                }
                if (MissionTargets.Contains(GameObject.Find("Redleaf_B")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Redleaf_B_Arrow"))
                {
                    MissionTargets.Remove(GameObject.Find("Redleaf_B"));
                    MissionArrows.FindLast((x) => x.name == "Redleaf_B_Arrow").SetActive(false);
                    MissionArrows.Remove(GameObject.Find("Redleaf_B_Arrow"));
                }
                if (MissionTargets.Contains(GameObject.Find("Redleaf_C")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Redleaf_C_Arrow"))
                {
                    MissionTargets.Remove(GameObject.Find("Redleaf_C"));
                    MissionArrows.FindLast((x) => x.name == "Redleaf_C_Arrow").SetActive(false);
                    MissionArrows.Remove(GameObject.Find("Redleaf_C_Arrow"));
                }
                if ((MissionTargets.Contains(GameObject.Find("Redleaf_A")) || MissionTargets.Contains(GameObject.Find("Redleaf_B")) || MissionTargets.Contains(GameObject.Find("Redleaf_C"))) &&
                    MissionArrows.FindLast((x) => x.gameObject != null && (x.name == "Redleaf_A_Arrow" || x.name == "Redleaf_B_Arrow" || x.name == "Redleaf_C_Arrow")))
                {
                    if (Arrow_RedLeaf)
                    {
                        MissionTargets.Add(GameObject.Find("Event_Soyna(Clone)"));
                    }
                    CameraMove(MissionTargets [MissionTargets.Count - 1], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), Arrow_RedLeaf);
                    Arrow_RedLeaf = false;
                }
                Blocking = null;
                break;

            case "控制引擎變數":

                /*if(MissionArrows.Contains(GameObject.Find ("Event_Riven(Clone)_MA")))
                 *      Destroy (MissionArrows.Find((x) => x.name == "Event_Riven(Clone)_MA"));*/
                if (MissionTargets.Contains(GameObject.Find("Engine")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Engine_Arrow"))
                {
                    MissionTargets.Remove(GameObject.Find("Engine"));
                    MissionArrows.FindLast((x) => x.name == "Engine_Arrow").SetActive(false);
                    MissionArrows.Remove(GameObject.Find("Engine_Arrow"));

                    if (Arrow_Engine)
                    {
                        MissionTargets.Add(GameObject.Find("Event_Riven(Clone)"));
                    }

                    CameraMove(MissionTargets [MissionTargets.Count - 1], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), Arrow_Engine);
                    Arrow_Engine = false;
                }
                Blocking = null;
                break;

            case "控制水晶變數":


                if (MissionTargets.Contains(GameObject.Find("Event_Station(Clone)")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Event_Station(Clone)_Arrow"))
                {
                    MissionTargets.Remove(GameObject.Find("Event_Station(Clone)"));
                    MissionArrows.FindLast((x) => x.name == "Event_Station(Clone)_Arrow").SetActive(false);
                    MissionArrows.Remove(GameObject.Find("Event_Station(Clone)_Arrow"));
                    if (Arrow_Kyder)
                    {
                        MissionTargets.Add(GameObject.Find("Event_Sisco(Clone)"));
                    }

                    //CameraMove (MissionTargets [MissionTargets.Count - 1], CameraController.CurrentCam, CameraController.CamTarget, new Vector3 (0, 5, 0), Arrow_Kyder);
                    Arrow_Kyder = false;
                }
                Blocking = null;
                break;
            }


            // Camera Move
            if (CurrentCam != null && ScreenHeart != null && Target != null && !FlowerChart.HasExecutingBlocks() && CamIsMoving && !FlowerChart.GetBooleanVariable("LookAround"))
            {
                if (Vector3.Distance(CurrentCam.transform.position, NextCamPos) <= 0.5f)
                {
                    MissionArrows [MissionArrows.Count - 1].SetActive(true);
                    CamRotTarget = Quaternion.LookRotation(ScreenHeart.transform.position - CurrentCam.transform.position, Vector3.Lerp(CurrentCam.transform.up, Target.transform.up, 0.1f));
                    CurrentCam.transform.rotation = Quaternion.Slerp(CurrentCam.transform.rotation, CamRotTarget, 0.2f);

                    ScreenHeart.transform.position = Vector3.Lerp(ScreenHeart.transform.position, NextHeartPos, 0.03f);
                    CurrentCam.transform.position  = Vector3.Lerp(CurrentCam.transform.position, NextCamPos, 0.03f);
                    if (Input.GetMouseButtonDown(0) || Vector3.Distance(CurrentCam.transform.position, NextCamPos) <= 0.3f)
                    {
                        if (MissionTargets.LastIndexOf(Target) != MissionTargets.Count - 1)
                        {
                            TargetID++;
                            CameraMove(MissionTargets[TargetID], CameraController.CurrentCam, CameraController.CamTarget, MultiPos, true);
                        }
                        else if (MissionTargets.LastIndexOf(Target) == MissionTargets.Count - 1)
                        {
                            TargetID++;
                            CamIsMoving      = false;
                            CamIsMovingBack  = true;
                            Global.StopTouch = true;
                        }
                    }
                }
                else
                {
                    // Camera is moving.
                    PlayerStatusImage.GetStatus("None");
                    ScreenHeart.transform.position = Vector3.Lerp(ScreenHeart.transform.position, NextHeartPos, 0.03f);
                    CurrentCam.transform.position  = Vector3.Lerp(CurrentCam.transform.position, NextCamPos, 0.03f);
                    CamRotTarget = Quaternion.LookRotation(ScreenHeart.transform.position - CurrentCam.transform.position, Vector3.Lerp(CurrentCam.transform.up, Target.transform.up, 0.1f));
                    CurrentCam.transform.rotation = Quaternion.Slerp(CurrentCam.transform.rotation, CamRotTarget, 0.6f);
                }
            }
            else if (CurrentCam != null && ScreenHeart != null && Target != null && !CamIsMoving && CamIsMovingBack)
            {
                if (Vector3.Distance(CurrentCam.transform.position, CurrentCam_Origin) <= 0.1f)
                {
                    TargetID = 0;
                    ScreenHeart.transform.position = ScreenHeart_Origin;
                    ScreenHeart.transform.rotation = ScreenHeart_OriginRot;
                    CurrentCam       = ScreenHeart = Target = null;
                    Global.StopTouch = false;
                    CamIsMovingBack  = false;
                }
                else
                {
                    // Camera is moving back.
                    ScreenHeart.transform.position = Vector3.Lerp(ScreenHeart.transform.position, ScreenHeart_Origin, 0.04f);
                    CurrentCam.transform.position  = Vector3.Lerp(CurrentCam.transform.position, CurrentCam_Origin, 0.04f);
                    CamRotTarget = Quaternion.LookRotation(ScreenHeart.transform.position - CurrentCam.transform.position, Vector3.Lerp(CurrentCam.transform.up, Vector3.up, 0.075f));
                    CurrentCam.transform.rotation = Quaternion.Slerp(CurrentCam.transform.rotation, CamRotTarget, 0.8f);
                }
            }



            // Get Block's Name
            if (FlowerChart.HasExecutingBlocks() && !AnotherOneshot)
            {
                AllBlocks      = FlowerChart.GetExecutingBlocks();
                Blocking       = AllBlocks [AllBlocks.Count - 1].BlockName;
                AnotherOneshot = true;
            }
            else if (!FlowerChart.HasExecutingBlocks() && AnotherOneshot)
            {
                Blocking       = null;
                AnotherOneshot = false;
            }

            // 第一章結尾
            if (Global.Level == "1")
            {
                if (FlowerChart.HasExecutingBlocks() && Blocking == "開飛船")
                {
                    if (Level01PlayerEvent.Ship && !Oneshot)
                    {
                        Oneshot = true;
                    }
                }
                else if (!Level01PlayerEvent.Ship && Oneshot)
                {
                    GameObject.Find("SpaceShip_Anim").GetComponent <Animation> ().Play("Fly");
                    CameraFade.FadeOut();
                    Global.Player.SetActive(false);
                    Global.NextScene = 3;                             // To Chapter 02
                    Oneshot          = false;
                }
            }

            if (Global.Level == "2")
            {
                if (FlowerChart.HasExecutingBlocks() && FlowerChart.SelectedBlock != null && Blocking == "閃人")
                {
                    if (!Oneshot && FlowerChart.GetBooleanVariable("PushBox01") && FlowerChart.GetBooleanVariable("FindLeaf") && FlowerChart.GetBooleanVariable("FindEngine") && FlowerChart.GetBooleanVariable("FindKyder"))
                    {
                        Oneshot = true;
                    }
                }
                else if (Oneshot)
                {
                    GameObject.Find("SpaceShip_Anim").GetComponent <Animation> ().Play("Fly2");
                    CameraFade.FadeOut();
                    Global.Player.SetActive(false);
                    Global.NextScene = 4;                             // To Chapter 03
                    Oneshot          = false;
                }
            }
        }

        // 對話時停止移動、轉動
        if (FlowerChart != null)
        {
            if (FlowerChart.HasExecutingBlocks() && BlockOn == false)
            {
                BlockOn          = true;
                Global.StopTouch = true;
                PlayerStatusImage.GetStatus("IsTalking");

                CameraController.OriginView = Camera.main.fieldOfView;
                //CameraController.CamView = 10;
            }
            else if (!FlowerChart.HasExecutingBlocks() && BlockOn == true && !CamIsMoving)
            {
                BlockOn = false;
                if (!CamIsMovingBack)
                {
                    Global.StopTouch = false;
                }
                EisPressed = false;
                PlayerStatusImage.GetStatus("None");


                CameraController.CamView = CameraController.OriginView;
            }
        }
    }