示例#1
0
    public void Init()
    {
        GameObject temp;

        allies  = GameObject.FindGameObjectsWithTag("Ally");
        enemies = GameObject.FindGameObjectsWithTag("Enemy");
        account = FileManager.AccountDataLoad("SaveFile/AccountData.txt");

        int i;

        floatingLabel_list = new List <GameObject>();
        button.onClick.AddListener(() => StartCoroutine(SceneConvert(5)));
        button.GetComponent <Image>().raycastTarget = false;

        if (floatingLabel_list.Count == 0)
        {
            for (i = 0; i < floatingTextPool.childCount; i++)
            {
                floatingLabel_list.Add(floatingTextPool.GetChild(i).gameObject);
            }
        }

        for (i = 0; i < allies.Length; i++)
        {
            temp = canvas.GetChild(0).GetChild(i).gameObject;
            temp.SetActive(true);
            allyQueue.Enqueue(temp);
        }
        for (i = 0; i < enemies.Length; i++)
        {
            temp = canvas.GetChild(1).GetChild(i).gameObject;
            temp.SetActive(true);
            enemyQueue.Enqueue(temp);
        }
    }
示例#2
0
    void Start()
    {
        SoundManager.Instance.PlayMainSound(lobby_main_clip);
        account = FileManager.AccountDataLoad("SaveFile/AccountData.txt"); // 계정 정보를 load해 적용.

        panel.transform.GetChild(0).GetChild(0).GetComponent <Text>().text = account.Access_name;
        panel.transform.GetChild(1).GetChild(0).GetComponent <Text>().text = account.Access_gold.ToString();
        panel.transform.GetChild(2).GetChild(0).GetComponent <Text>().text = "LV " + account.Access_level.ToString();
    }
    int type_temp; // 현재 선택한 아이템의 타입(store or inventory) 변수

    void Awake()
    {
        SoundManager.Instance.PlayMainSound(main_clip);
        account            = FileManager.AccountDataLoad("SaveFile/AccountData.txt");
        store_itemList     = FileManager.ListDataLoad <EquipmentData>("SaveFile/StoreData/StoreItemList.txt");         // 상점의 정보를 load해 적용.
        inventory_itemList = FileManager.ListDataLoad <EquipmentData>("SaveFile/InventoryData/InventoryItemList.txt"); // 인벤토리 정보를 load해 적용.
        infolist           = informationwindow.transform.Find("InfoList");
        temp_infoImage     = informationwindow.transform.Find("Image").transform.GetChild(0).GetComponent <Image>();

        idx_temp = -1;

        ButtonSetting();
        PanelSetting();
        ItemListSetting(1);
        ItemListSetting(2);
    }
    void Awake()
    {
        state = MapState.idle;
        SoundManager.Instance.PlayMainSound(main_clip);
        account = FileManager.AccountDataLoad("SaveFile/AccountData.txt");
        panel.GetChild(0).GetChild(0).GetComponent <Text>().text = account.Access_name;
        panel.GetChild(1).GetChild(0).GetComponent <Text>().text = account.Access_gold.ToString();
        panel.GetChild(2).GetChild(0).GetComponent <Text>().text = "LV " + account.Access_level.ToString();

        ButtonSetting();
        current_stage             = "Stage" + account.Access_currentstage.ToString();
        player.transform.position = GameObject.Find(current_stage).transform.position - new Vector3(0, 0.5f, 0);
        for (int i = 0; i < account.Access_currentstage; i++) // 이미 완료한 스테이지 비활성화
        {
            waypoint.GetChild(i).tag = "Untagged";
            waypoint.GetChild(i).GetChild(0).gameObject.SetActive(false);
        }

        StartCoroutine(Idle());
    }
示例#5
0
    void Awake()
    {
        Transform temp;

        paneltemp_equipment      = panel.Find("Equipment");
        paneltemp_faceImage      = panel.Find("faceImage");
        paneltemp_textlist       = panel.Find("textList");
        InventoryWindow_itemlist = InventoryWindow.Find("List").GetChild(0);
        exp_data = FileManager.ListDataLoad <int>("SaveFile/ExpData.txt");
        account  = FileManager.AccountDataLoad("SaveFile/AccountData.txt");

        for (int i = 0; i < account.Access_numofcharacter; i++)
        {
            temp = characterList.GetChild(i);
            temp.gameObject.SetActive(true);
            InfoSetting(i, temp);
        }

        ButtonSetting();
    }
    void GetReward(int idx)
    {
        switch (idx)
        {
        case 0:     // 골드 획득
            int temp;
            account = FileManager.AccountDataLoad("SaveFile/AccountData.txt");
            temp    = ((int)stage.Access_grade + 1) * 500;  // 스테이지 등급에 따라 골드 획득량 결정
            FileManager.DataGenerate <AccountData>("SaveFile/AccountData.txt",
                                                   new AccountData(account.Access_name, account.Access_level, account.Access_gold + temp, account.Access_numofcharacter, account.Access_currentstage));
            FileManager.DataGenerate <Account>("SaveFile/AccountData.txt", account);
            break;

        case 1:     // 레어 아이템 획득
            temp_obj = FileManager.ListDataLoad <EquipmentData>("SaveFile/EquipmentData/RareEquipmentList.txt");
            reward_param.Add(temp_obj[Random.Range(0, temp_obj.Count)]);
            temp_obj = FileManager.ListDataLoad <EquipmentData>("SaveFile/InventoryData/InventoryItemList.txt");
            temp_obj.Add(reward_param[reward_param.Count - 1]);
            FileManager.ListDataGenerate <EquipmentData>("SaveFile/InventoryData/InventoryItemList.txt", temp_obj);
            break;

        case 2:     // 유니크 아이템 획득
            temp_obj = FileManager.ListDataLoad <EquipmentData>("SaveFile/EquipmentData/UniqueEquipmentList.txt");
            reward_param.Add(temp_obj[Random.Range(0, temp_obj.Count)]);
            temp_obj = FileManager.ListDataLoad <EquipmentData>("SaveFile/InventoryData/InventoryItemList.txt");
            temp_obj.Add(reward_param[reward_param.Count - 1]);
            FileManager.ListDataGenerate <EquipmentData>("SaveFile/InventoryData/InventoryItemList.txt", temp_obj);
            break;

        case 3:     // 전설 아이템 획득
            temp_obj = FileManager.ListDataLoad <EquipmentData>("SaveFile/EquipmentData/LegendEquipmentList.txt");
            reward_param.Add(temp_obj[Random.Range(0, temp_obj.Count)]);
            temp_obj = FileManager.ListDataLoad <EquipmentData>("SaveFile/InventoryData/InventoryItemList.txt");
            temp_obj.Add(reward_param[reward_param.Count - 1]);
            FileManager.ListDataGenerate <EquipmentData>("SaveFile/InventoryData/InventoryItemList.txt", temp_obj);
            break;
        }
    }
    void InitBattle()
    {
        SoundManager.Instance.PlayMainSound(battle_clip);
        account       = FileManager.AccountDataLoad("SaveFile/AccountData.txt");
        current_stage = "Stage" + (account.Access_currentstage + 1).ToString();
        stage         = FileManager.StageDataLoad("SaveFile/StageData/" + current_stage + ".txt");

        #region 아군 캐릭터 리스트 생성
        for (int i = 0; i < account.Access_numofcharacter; i++)
        {
            allies.Add(account.Access_character(i));
            allies[i].tag = "Ally";

            if (allies[i].GetComponent <BarAnimation>() == null)
            {
                allies[i].AddComponent <BarAnimation>();
            }

            if (allies[i].GetComponent <AllyCharacter>().Access_atktype == AttackType.Melee)
            {
                if (allies[i].GetComponent <MeleeAttack>() == null)
                {
                    allies[i].AddComponent <MeleeAttack>();
                }
            }
            else
            {
                if (allies[i].GetComponent <RangeAttack>() == null)
                {
                    allies[i].AddComponent <RangeAttack>();
                }
            }

            if (allies[i].GetComponent <StatusEffectManager>() == null)
            {
                allies[i].AddComponent <StatusEffectManager>();
            }
        }
        #endregion

        #region 적군 캐릭터 리스트 생성
        for (int i = 0; i < stage.Access_enemylist.Count; i++)
        {
            enemies.Add(FileManager.CharacterDataLoad("SaveFile/EnemyData/" + stage.Access_enemylist[i] + ".txt"));
            enemies[i].tag = "Enemy";
            if (enemies[i].GetComponent <BarAnimation>() == null)
            {
                enemies[i].AddComponent <BarAnimation>();
            }
            if (enemies[i].GetComponent <EnemyCharacter>().Access_atktype == AttackType.Melee)
            {
                if (enemies[i].GetComponent <MeleeAttack>() == null)
                {
                    enemies[i].AddComponent <MeleeAttack>();
                }
            }
            else
            {
                if (enemies[i].GetComponent <RangeAttack>() == null)
                {
                    enemies[i].AddComponent <RangeAttack>();
                }
            }
            if (enemies[i].GetComponent <StatusEffectManager>() == null)
            {
                enemies[i].AddComponent <StatusEffectManager>();
            }
        }
        #endregion

        SpawnCharacters(allies); // 아군, 적군 리스트를 씬에 소환
        SpawnCharacters(enemies);

        GetComponent <BattleUIManager>().Init(); // 전투 직전 모든 초기화 진행
        foreach (GameObject ally in allies)
        {
            ally.GetComponent <AllyCharacter>().Init();
        }
        foreach (GameObject enemy in enemies)
        {
            enemy.GetComponent <EnemyCharacter>().Init();
        }
        StartCoroutine(update());
    }
示例#8
0
    public IEnumerator EndGame_Animation(bool value, int[,] param_data, List <EquipmentData> reward_list) // 게임이 종료됐을 경우 작동하는 코루틴, 유저가 이길 경우 value = true, 졌을 경우 value = false;
    {
        int i, j;

        account = FileManager.AccountDataLoad("SaveFile/AccountData.txt");
        List <GameObject> characterlist = account.Access_characters;
        List <int>        exp_data      = FileManager.ListDataLoad <int>("SaveFile/ExpData.txt"); // 경험치 차트 로드
        Transform         end_ui        = canvas2.GetChild(3);
        Transform         message       = end_ui.GetChild(0);
        Transform         characters    = end_ui.GetChild(1);
        Transform         rewards       = end_ui.GetChild(2);
        Transform         rewards_list  = rewards.GetChild(0);
        Transform         Button        = end_ui.GetChild(3);
        Transform         temp_transform;
        AllyCharacter     temp_component;
        float             temp_calc;

        yield return(StartCoroutine(EndGameEffect()));

        for (i = 0; i < allies.Length; i++) // 각 캐릭터에 승리 애니메이션 작동
        {
            if (allies[i].GetComponent <AllyCharacter>().Access_State != CharacterState.Dead)
            {
                allies[i].GetComponent <AllyCharacter>().Access_animator.SetInteger("State", 3);
            }
        }

        if (value)
        {
            end_ui.gameObject.SetActive(true);
            for (i = 0; i < allies.Length; i++) // panel에 담길 정보 setting
            {
                temp_transform = characters.GetChild(i);
                temp_component = characterlist[i].GetComponent <AllyCharacter>();
                temp_transform.gameObject.SetActive(true);
                temp_transform.GetChild(0).GetComponent <Text>().text            = "LV." + param_data[i, 0].ToString() + " " + temp_component.Access_charactername;
                temp_transform.GetChild(1).GetComponent <Image>().overrideSprite = Resources.Load <Sprite>("Sprite/" + temp_component.Access_faceimage.ToString());
                temp_calc = (float)param_data[i, 1] / exp_data[param_data[i, 0]];
                temp_transform.GetChild(2).GetChild(1).GetComponent <Slider>().value = temp_calc;
                temp_transform.GetChild(2).GetChild(2).GetComponent <Text>().text    = (temp_calc * 100).ToString("F1") + " %";

                rewards_list.GetChild(0).GetChild(1).GetComponent <Image>().overrideSprite = Resources.Load <Sprite>("Sprite/coin");
                rewards_list.GetChild(0).GetChild(2).GetComponent <Text>().text            = "골드";
                rewards_list.GetChild(0).gameObject.SetActive(true);
                for (j = 0; j < reward_list.Count; j++)
                {
                    temp_transform = rewards_list.GetChild(j + 1);
                    temp_transform.GetChild(1).GetComponent <Image>().overrideSprite = Resources.Load <Sprite>("Sprite/" + reward_list[j].equipmentname);
                    switch (reward_list[j].grade)
                    {
                    case EquipmentGrade.common:
                        temp_transform.GetChild(2).GetComponent <Text>().text = reward_list[j].equipmentname;
                        break;

                    case EquipmentGrade.rare:
                        temp_transform.GetChild(2).GetComponent <Text>().text = "<color=cyan>" + reward_list[j].equipmentname + "</color>";
                        break;

                    case EquipmentGrade.unique:
                        temp_transform.GetChild(2).GetComponent <Text>().text = "<color=magenta>" + reward_list[j].equipmentname + "</color>";
                        break;

                    case EquipmentGrade.legend:
                        temp_transform.GetChild(2).GetComponent <Text>().text = "<color=orange>" + reward_list[j].equipmentname + "</color>";
                        break;
                    }
                    temp_transform.gameObject.SetActive(true);
                }
            }
            message.GetComponentInChildren <Text>().text = "승 리 !";
            yield return(new WaitForSeconds(2));

            for (i = 0; i <= 400; i += 6) // panel 이동 애니메이션
            {
                message.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(0, i, 0);
                yield return(null);
            }
            for (i = 0; i <= 300; i += 4)
            {
                characters.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(i * 3 - 1300, 0, 0);
                rewards.GetComponent <RectTransform>().anchoredPosition3D    = new Vector3(1300 - i * 3, 0, 0);
                Button.GetComponent <RectTransform>().anchoredPosition3D     = new Vector3(0, i * 0.67f - 600, 0);
                yield return(null);
            }

            for (i = 0; i < allies.Length; i++) // panel 이동이 완료된 이후 UI애니메이션 (캐릭터 당 1개의 코루틴 동작)
            {
                StartCoroutine(EndGame_SliderAnimation(i, param_data[i, 0], param_data[i, 1], characters.GetChild(i), exp_data));
            }
            button.GetComponent <Image>().raycastTarget = true;
        }
        else
        {
            end_ui.gameObject.SetActive(true);
            message.GetComponentInChildren <Text>().text = "패 배 !";
            for (i = 0; i <= 380; i += 4)
            {
                Button.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(0, i - 620, 0);
                yield return(null);
            }
            button.onClick.AddListener(() => StartCoroutine(SceneConvert(0)));
            button.GetComponent <Image>().raycastTarget = true;
        }
    }