Exemple #1
0
    //캐릭터에 대한 초기화 및 배치를 함
    public virtual void Setup(CharacterStats _charic, CharacterManager _charicManager, SkillManager _skillManager, BattleManager _BattleManager, E_Type _E_TYPE, Vector3 _vecPosition, int _nBatchIndex = 0)
    {
        baseCharicStats = _charic;
        charicStats     = new CharacterStats(_charic);

        //스킬 매니저와 캐릭터 매니저를 등록
        skillManager     = _skillManager;
        characterManager = _charicManager;
        battleManager    = _BattleManager;

        //타입을 저장
        E_CHARIC_TYPE = _E_TYPE;

        //캐릭터 타입이 플레이어 캐릭일 경우
        if (E_CHARIC_TYPE == E_Type.E_Hero)
        {
            //패시브 스킬들을 적용
            ActivePassiveSkill();

            //처음 위치를 미리 저장해둔다.
            m_VecFirstPosition            = _vecPosition;
            gameObject.transform.position = m_VecFirstPosition;

            //캐릭터 UI들을 생성
            GameObject Charic_UI_Object = Instantiate(Resources.Load("Prefabs/Battle_Charic_Info") as GameObject);

            //생성된 캐릭터를 부모를 UI로 해줌
            Charic_UI_Object.transform.SetParent(battleManager.characterUI_Parent, false);

            //캐릭터 UI를 받아와서 세팅
            characterUI = Charic_UI_Object.GetComponent <CharacterUI> ();
            characterUI.SetUp(charicStats.m_fHealth);
        }
        else
        {
            gameObject.transform.position = _vecPosition;

            spriteRender.flipX = true;
        }

        //캐릭터의 현재 체력을 셋팅
        m_fCurrentHp = charicStats.m_fHealth;
        m_fMaxHp     = m_fCurrentHp;

        animator.runtimeAnimatorController = ObjectCashing.Instance.LoadAnimationController("Animation/Character/" + charicStats.m_strJob);

        CheckCharacterState(E_CHARACTER_STATE.E_WAIT);
    }