Exemple #1
0
    CharacterImg CharaOK(string _charaName)
    {
        if (_charaName == "")
        {
            return(null);
        }
        CharacterImg result = null;

        for (int i = 0; i < UICanvas.instance.charaImgList.Count; i++)
        {
            if (UICanvas.instance.charaImgList[i].name == _charaName)
            {
                result = UICanvas.instance.charaImgList[i];
                break;
            }
        }
        if (result == null)
        {
            Debug.Log(_charaName + " 라는 이름의 캐릭터가 없습니다.");
        }
        return(result);
    }
Exemple #2
0
    void FaceImgSet(CharacterImg _character, string _faceName, int _pos)
    {
        CharacterImg.CharaFace nowChara = new CharacterImg.CharaFace();
        Sprite faceSprite = _character.faceList[0].faceImg;

        //아무런 스프라이트가 없을 경우, 기본적으로 0번에 있는 face를 리턴.
        for (int i = 0; i < _character.faceList.Count; i++)
        {
            nowChara = _character.faceList[i];
            if (nowChara.name == _faceName)
            {
                faceSprite = nowChara.faceImg;
                break;
            }
        }

        if (faceSprite == null)
        {
            Debug.LogWarning(_character.name + "라는 이름의 캐릭터도, "
                             + _faceName + "라는 페이스 이미지도 없습니다.");
            return;
        }

        TextPrint_Chara targetChara = FindChara(_character.name);

        if (targetChara == null)
        {
            return;                      //버그방지용
        }
        targetChara.ChangeImg(faceSprite);
        targetChara.img.SetNativeSize();
        if (!targetChara.firstUse && _pos == 999)
        {
            _pos = 0;
        }
        NoDupliLocation(_pos, targetChara.charaName);
        Vector3 nextPos = charaImgPos.GetPosition(_pos);

        if (nextPos != new Vector3(999, 999)) //Vector3 999, 999는 위치값이 존재하지 않다는 뜻
        {
            targetChara.ChangeTransform(_pos, nextPos);
        }
        targetChara.transform.position = new Vector3(targetChara.transform.position.x + nowChara.facePos.x,
                                                     targetChara.transform.position.y + nowChara.facePos.y,
                                                     targetChara.transform.position.z);
        targetChara.transform.localScale = new Vector3(
            nowChara.faceScale.x * (nowChara.faceFlipX ? -1 : 1) * (_pos < 0 ? -1 : 1),
            nowChara.faceScale.y, 1);

        for (int i = 0; i < charaList.Count; i++)
        {
            if (charaList[i] == targetChara)
            {
                charaList[i].ImgEffect();
            }
            else
            {
                charaList[i].ImgEffect(Mathf.Abs(charaList[i].nowPos) + 1);
            }
        }
    }