예제 #1
0
    } // 클래스에 따른 장비 선택 분류 메소드

    void ClickEquipmentOnInventory(int param_maintype, int param_idx, AllyCharacter param_character) // 인벤토리 창에서 장비를 선택했을 때 콜백
    {
        templist = FileManager.ListDataLoad <EquipmentData>("SaveFile/InventoryData/InventoryItemList.txt"); // 인벤토리 아이템 리스트 로드
        for (int i = 0; i < templist.Count; i++)
        {
            if (templist[i].isMounted && templist[i].whoMounted == param_character.Access_charactername && templist[i].maintype == (EquipmentMainType)param_maintype)
            {
                templist[i].isMounted = false;
            }
        }
        templist[param_idx].isMounted  = true;
        templist[param_idx].whoMounted = param_character.Access_charactername;

        param_character.Access_equipment(param_maintype, templist[param_idx]);
        FileManager.ListDataGenerate <EquipmentData>("SaveFile/InventoryData/InventoryItemList.txt", templist);

        templist2 = FileManager.ListDataLoad <EquipmentData>("SaveFile/UserData/" + param_character.Access_prefabname + "EquipList.txt"); // 캐릭터 아이템 리스트 로드
        templist2[param_maintype] = templist[param_idx];
        FileManager.ListDataGenerate <EquipmentData>("SaveFile/UserData/" + param_character.Access_prefabname + "EquipList.txt", templist2);

        for (int i = 0; i < InventoryWindow_itemlist.childCount; i++)
        {
            InventoryWindow_itemlist.GetChild(i).gameObject.SetActive(false);
        }
        InventoryWindow.gameObject.SetActive(false);
        HeroClickExecute(selectIndex);
    }
예제 #2
0
    void HeroClickExecute(int idx) // 영웅 버튼 클릭시 콜백
    {
        if (!panel.gameObject.activeInHierarchy)
        {
            panel.gameObject.SetActive(true);
        }

        selectIndex = idx;
        AllyCharacter temp = account.Access_character(selectIndex).GetComponent <AllyCharacter>();

        temp.Access_equipments = FileManager.ListDataLoad <EquipmentData>("SaveFile/UserData/" + temp.Access_prefabname + "EquipList.txt");
        temp_atkpower          = temp_atkspeed = temp_defpower = temp_hp = 0;
        for (int i = 0; i < temp.Access_equipments.Count; i++)
        {
            temp_atkpower += temp.Access_equipment(i).atkpower;
            temp_atkspeed += temp.Access_equipment(i).atkspeed;
            temp_defpower += temp.Access_equipment(i).defpower;
        }
        paneltemp_faceImage.GetComponent <Image>().overrideSprite = Resources.Load <Sprite>("Sprite/" + temp.Access_faceimage.ToString());
        paneltemp_textlist.GetChild(0).GetComponent <Text>().text = temp.Access_charactername;
        paneltemp_textlist.GetChild(1).GetComponent <Text>().text =
            "LV : " + temp.Access_level.ToString() + " <color=lime> ( " + ((float)temp.Access_exp / exp_data[temp.Access_level] * 100).ToString("F1") + " % )</color>";
        paneltemp_textlist.GetChild(2).GetComponent <Text>().text = "HP : " + temp.Access_maxhealthpoint + AdditionalText(temp_hp);
        paneltemp_textlist.GetChild(3).GetComponent <Text>().text = "공격력 : " + temp.Access_atkpower.ToString() + AdditionalText(temp_atkpower);
        paneltemp_textlist.GetChild(4).GetComponent <Text>().text = "공격속도 : " + temp.Access_atkspeed.ToString("F2") + AdditionalText(temp_atkspeed);
        paneltemp_textlist.GetChild(5).GetComponent <Text>().text = "방어력 : " + temp.Access_defpower.ToString() + AdditionalText(temp_defpower);
        skill_image.GetComponent <Image>().overrideSprite         = Resources.Load <Sprite>("Sprite/skillImage" + temp.Access_skillimage.ToString());
        skill_manual.GetComponent <Text>().text = temp.Access_skillname + "\n" +
                                                  ((Skill)temp.GetComponent(temp.Access_skillname)).Access_skill_manual;
        paneltemp_equipment.GetChild(0).GetChild(0).GetComponent <Image>().overrideSprite = Resources.Load <Sprite>("Sprite/" + temp.Access_equipment(0).equipmentname);
        paneltemp_equipment.GetChild(1).GetChild(0).GetComponent <Image>().overrideSprite = Resources.Load <Sprite>("Sprite/" + temp.Access_equipment(1).equipmentname);
        paneltemp_equipment.GetChild(2).GetChild(0).GetComponent <Image>().overrideSprite = Resources.Load <Sprite>("Sprite/" + temp.Access_equipment(2).equipmentname);
    }
예제 #3
0
    IEnumerator EndGame_SliderAnimation(int character_idx, int level, int exp, Transform characterUI, List <int> exp_data) // 배틀 종료 후 패널의 UI의 애니메이션 기능을 하는 코루틴
    {
        AllyCharacter temp_character  = allies[character_idx].GetComponent <AllyCharacter>();
        Slider        slider          = characterUI.GetChild(2).GetChild(1).GetComponent <Slider>();
        Text          percent_exp     = characterUI.GetChild(2).GetChild(2).GetComponent <Text>();
        Text          character_level = characterUI.GetChild(0).GetComponent <Text>();
        int           temp_level      = level;
        float         exp_ratio       = (float)temp_character.Access_exp / exp_data[temp_character.Access_level];

        while ((temp_level != temp_character.Access_level) || Mathf.Abs(exp_ratio - slider.value) > 0.01f)
        {
            yield return(null);

            slider.value    += 0.01f;
            percent_exp.text = (slider.value * 100).ToString("F0") + " %";
            if (slider.value == 1)
            {
                characterUI.GetChild(3).gameObject.SetActive(true); // 레벨업 마크 표시
                slider.value         = 0;
                percent_exp.text     = "0.0 %";
                temp_level          += 1;
                character_level.text = "LV." + temp_level.ToString() + " " + temp_character.Access_charactername;
            }
        }
    }
예제 #4
0
    public override AIBase fixedLogicTick()
    {
        // Search for an enemy
        float   vision   = character.getCharacterStats().getVision();
        Vector2 topLeft  = (Vector2)character.transform.position - new Vector2(vision, -vision);
        Vector2 botRight = (Vector2)character.transform.position + new Vector2(vision, -vision);

        List <AllyCharacter> eQuery = LevelManager.instance().current().getObjectsInRange <AllyCharacter>(topLeft, botRight);

        if (eQuery != null)
        {
            AllyCharacter target  = null;
            float         closest = vision;
            foreach (AllyCharacter a in eQuery)
            {
                float distance = (a.transform.position - character.transform.position).magnitude;
                if (distance <= closest)
                {
                    target  = a;
                    closest = distance;
                }
            }
            if (target != null)
            {
                return(new AttackingAI(target));
            }
        }
        return(null);
    }
예제 #5
0
    protected override IEnumerator ActiveSkill()
    {
        enemies = GameObject.FindGameObjectsWithTag("Enemy");
        if (enemies.Length != 0)
        {
            temp   = GetComponent <AllyCharacter>();
            origin = transform.position;
            dest   = enemies[0].transform.position + new Vector3(-1.5f, 0, 0);
            dir    = (dest - transform.position).normalized;

            SetAnimation(5); // 앞으로 전진
            yield return(new WaitForSeconds(0.1f));

            while (Vector3.Distance(transform.position, dest) >= 0.1f)
            {
                yield return(null);

                transform.Translate(dir * movespeed, Space.World);
            }

            SetAnimation(4); // 공격 모션
            yield return(new WaitForSeconds(0.3f));

            AttackTrigger(enemies[0], temp.Access_atkpower);
            PlaySound(0);
            yield return(new WaitForSeconds(0.37f));

            AttackTrigger(enemies[0], temp.Access_atkpower);
            PlaySound(0);
            yield return(new WaitForSeconds(0.37f));

            AttackTrigger(enemies[0], temp.Access_atkpower);
            PlaySound(0);
            yield return(new WaitForSeconds(0.37f));

            SetAnimation(5);  // 뒤로 후진
            transform.forward *= -1;
            while (Vector3.Distance(transform.position, origin) >= 0.1f)
            {
                yield return(null);

                transform.Translate(-dir * movespeed, Space.World);
            }
            SetAnimation(0);
            yield return(new WaitForSeconds(0.1f));

            yield return(StartCoroutine(InitializeSkill()));

            transform.forward *= -1;
        }
    }
예제 #6
0
    void EquipmentClickExecute(int idx) // panel 상에서 장비 버튼 클릭시 콜백
    {
        InventoryWindow.gameObject.SetActive(true);
        List <EquipmentData> tempList      = FileManager.ListDataLoad <EquipmentData>("SaveFile/InventoryData/InventoryItemList.txt");
        AllyCharacter        tempCharacter = account.Access_character(selectIndex).GetComponent <AllyCharacter>();

        for (int i = 0; i < tempList.Count; i++)
        {
            if (ClassToSubtype((EquipmentMainType)idx, tempCharacter.Access_Class, tempList[i].subtype) && !tempList[i].isMounted)
            {
                Transform temp     = InventoryWindow_itemlist.GetChild(i);
                int       temp_idx = i;
                temp.gameObject.SetActive(true);
                temp.GetComponent <Button>().onClick.RemoveAllListeners();
                temp.GetComponent <Button>().onClick.AddListener(() => ClickEquipmentOnInventory(idx, temp_idx, tempCharacter));
                temp.GetChild(0).GetComponent <Text>().text = tempList[i].equipmentname;
                temp.GetChild(1).GetChild(0).GetComponent <Image>().overrideSprite = Resources.Load <Sprite>("Sprite/" + tempList[i].equipmentname);
            }
        }
    }
예제 #7
0
    public void AttackTrigger(GameObject opponent, float damage) // 공격 발생 함수
    {
        AllyCharacter temp = opponent.GetComponent <AllyCharacter>();

        temp.AttackedByTrigger(damage);
    }