コード例 #1
0
ファイル: DialogueWindow.cs プロジェクト: piotrpuszk/TGK
    public void OnTalkPrompt()
    {
        if (show == false)
        {
            current_option_set = actor.getOptionSetById(_nextId);
            show   = true;
            cursor = 0;
            Camera.SetCanMove(false);
            PlayerController.CanMove = false;
        }
        else
        {
            if (options.Count > cursor && options[cursor] == String.Empty)
            {
                show = false;
                Camera.SetCanMove(true);
                PlayerController.CanMove = true;
            }
            string action = actor.Actions[current_option_set][cursor];

            string[] command = action.Split(' ');

            List <string> missions = actor.Missions[current_option_set];

            foreach (string mission in missions)
            {
                if (mission != null && mission != "")
                {
                    story.AddMission(mission);
                }
            }

            List <string> missionCompletes = actor.MissionCompletes[current_option_set];


            foreach (string missionComplete in missionCompletes)
            {
                if (missionComplete != null && missionComplete != "")
                {
                    story.CompleteMission(missionComplete);
                }
            }

            string nextid = actor.NextIds[current_option_set][cursor];
            if (!String.IsNullOrEmpty(nextid))
            {
                _nextId = nextid;
                if (gameObject.GetComponent <DialogueActor>().actorName == "Boren")
                {
                    if (_onlyOneTimeChangeId && _nextId != "0")
                    {
                        _onlyOneTimeChangeId = false;
                        GameObject.FindGameObjectWithTag("storyobject").SendMessage("TryToChangeBorenNextId");
                    }
                }
            }

            if (command.Length > 1 && command[0].Equals("set"))
            {
                current_option_set = actor.getOptionSetById(command[1]);
                cursor             = 0;
            }
            else
            {
                show = false;
                Camera.SetCanMove(true);
                PlayerController.CanMove = true;
            }
        }
    }