Example #1
0
    IEnumerator PlotRoutine(ERole ident, Action <string> onPlot, PlotConf conf)
    {
        if (conf._triggerRoleIdent != ident)
        {
            yield break;
        }
        List <SingleConvers> converses = new List <SingleConvers>(conf.conversList);

        while (converses.Count >= 0)
        {
            RoleConf role = GameData._Instance._roleLib.GetRole(converses[0]._roleIdent);
            if (role == null)
            {
                converses.RemoveAt(0);
                continue;
            }

            string s = role._name + (string.IsNullOrEmpty(role._name) ? "" : ":") + converses[0]._convers;
            if (onPlot != null)
            {
                onPlot(s);
            }

            // there is no need to wait if the length of conversation is zero.
            converses.RemoveAt(0);
            if (converses.Count == 0)
            {
                ClearMeetRoutine();
                break;
            }
            yield return(new WaitForSeconds(GameData._Instance._conversSpeed));
        }
    }
Example #2
0
    public void Init(ERole roleIdent, Sprite[] moveSprites)
    {
        _roleIdent   = roleIdent;
        _moveSprites = moveSprites;

        RoleConf role = GameData._Instance._roleLib.GetRole(roleIdent);

        if (role != null)
        {
            _nameText.text = role._name;
        }
    }