Exemple #1
0
    BarAnimation baranim; // 슬라이더 움직임 제어를 위한 변수
    #endregion

    public void Init()
    {
        allies           = GameObject.FindGameObjectsWithTag("Enemy");
        enemies          = GameObject.FindGameObjectsWithTag("Ally");
        battle_manager   = GameObject.FindGameObjectWithTag("BattleManager").GetComponent <BattleManager>();
        battle_uimanager = battle_manager.GetComponent <BattleUIManager>();
        Access_animator  = GetComponent <Animator>();
        AttackTypeSetting();

        #region 슬라이더 UI 초기화
        canvas = battle_uimanager.Sliderpool_Pop(this.gameObject);
        canvas.transform.GetChild(0).GetComponent <Text>().text = Access_charactername;
        hpslider     = canvas.transform.GetChild(2).GetChild(2).GetComponent <Slider>();
        hpslider2    = canvas.transform.GetChild(2).GetChild(1).GetComponent <Slider>();
        attackslider = canvas.transform.GetChild(1).GetComponent <Slider>();
        headupPos    = transform.GetChild(0).gameObject;
        canvas.transform.position = headupPos.transform.position;
        baranim = GetComponent <BarAnimation>();
        baranim.Init(hpslider, hpslider2, attackslider);
        #endregion

        Access_State = CharacterState.Idle;
        main_routine = Idle();
        StartCoroutine(main_routine);
        StartCoroutine(update());
    }
    BarAnimation baranim; // 슬라이더 움직임 제어를 위한 변수
    #endregion

    public void Init()
    {
        skill            = (Skill)GetComponent(Access_skillname);
        allies           = GameObject.FindGameObjectsWithTag("Ally");
        enemies          = GameObject.FindGameObjectsWithTag("Enemy");
        isdead_UI        = GameObject.FindGameObjectWithTag("ScreenUI").transform.Find(Access_prefabname).Find("IsDead").gameObject;
        battle_manager   = GameObject.FindGameObjectWithTag("BattleManager").GetComponent <BattleManager>();
        battle_uimanager = battle_manager.GetComponent <BattleUIManager>();
        Access_animator  = GetComponent <Animator>();
        AttackTypeSetting();

        #region 슬라이더 UI 초기화
        canvas       = battle_uimanager.Sliderpool_Pop(this.gameObject);
        hpslider     = canvas.transform.Find("HpBar").Find("HpSlider").GetComponent <Slider>();
        hpslider2    = canvas.transform.Find("HpBar").Find("HpSlider2").GetComponent <Slider>();
        attackslider = canvas.transform.Find("AtkSlider").GetComponent <Slider>();
        headupPos    = transform.GetChild(0).gameObject;
        canvas.transform.position = headupPos.transform.position;
        baranim = GetComponent <BarAnimation>();
        baranim.Init(hpslider, hpslider2, attackslider);
        #endregion

        #region 스크린 UI 초기화
        ((Skill)GetComponent(Access_skillname)).Init();
        Transform screenUI = GameObject.FindGameObjectWithTag("ScreenUI").transform.Find(canvas.name);
        screenUI.gameObject.SetActive(true);
        screenUI.Find("FaceImage").GetComponent <Image>().overrideSprite  = Resources.Load <Sprite>("Sprite/" + Access_faceimage.ToString());
        screenUI.Find("SkillImage").GetComponent <Image>().overrideSprite = Resources.Load <Sprite>("Sprite/skillImage" + Access_skillimage.ToString());
        #endregion

        #region 장비 능력치 적용
        for (int i = 0; i < Access_equipments.Count; i++)
        {
            if (Access_equipment(i) != null)
            {
                Access_atkpower += Access_equipment(i).atkpower;
                Access_atkspeed += Access_equipment(i).atkspeed;
                Access_defpower += Access_equipment(i).defpower;
            }
        }
        #endregion

        canvas.transform.GetChild(0).GetComponent <Text>().text = "LV." + Access_level.ToString() + " " + Access_charactername;
        Access_State = CharacterState.Idle;
        main_routine = Idle();
        StartCoroutine(main_routine);
        StartCoroutine(update());
    }