Beispiel #1
0
    /// <summary>
    /// 각 스킬 프리팹을 풀링하는 함수
    /// </summary>
    /// <param name="prefab">풀링할 프리팹</param>
    /// <param name="type">스킬의 단축키("Q", "W", "E", "R")</param>
    /// <param name="amount">풀링할 갯수</param>
    private void Pooling(GameObject prefab, string type, int amount = 10)
    {
        if (!skillObj.ContainsKey(type))
        {
            List <GameObject> list = new List <GameObject>();
            skillObj.Add(type, list);
        }

        List <GameObject> tempList = new List <GameObject>();

        // 프리팹을 생성
        for (int i = 0; i < amount; ++i)
        {
            GameObject obj = Instantiate(prefab, mySkills.transform);
            obj.GetComponent <SkillFactioner>().skillChampFogEntity = TheChampionBehaviour.GetComponent <FogOfWarEntity>();

            if (team == "")
            {
                team = GetComponent <PhotonView>().owner.GetTeam().ToString();
            }

            if (team.Equals("red"))
            {
                obj.GetComponent <FogOfWarEntity>().faction = FogOfWar.Players.Player00;
            }
            else if (team.Equals("blue"))
            {
                obj.GetComponent <FogOfWarEntity>().faction = FogOfWar.Players.Player01;
            }

            //임시 리스트에 프리팹들을 담는다
            obj.SetActive(false);
            tempList.Add(obj);

            switch (type)
            {
            case "Q":
                obj.GetComponent <AlistarQ>().mySkill = this;
                break;

            case "E":
                obj.GetComponent <AlistarE>().mySkill = this;
                break;
            }
        }

        //기존의 스킬 프리팹 리스트에 임시 리스트의 항목을 합쳐 넣는다.
        skillObj[type].InsertRange(0, tempList);
    }
Beispiel #2
0
    public void Pooling(GameObject prefab, string type, int amount = 10)
    {
        if (!SkillObj.ContainsKey(type))
        {
            List <GameObject> list = new List <GameObject>();
            SkillObj.Add(type, list);
        }
        List <GameObject> tempList = new List <GameObject>();

        for (int i = 0; i < amount; ++i)
        {
            GameObject obj = Instantiate(prefab, mySkills.transform);
            obj.GetComponent <SkillFactioner>().ChampFogEntity = TheChampionBehaviour.GetComponent <FogOfWarEntity>();
            if (team == "")
            {
                team = GetComponent <PhotonView>().owner.GetTeam().ToString();
            }
            if (team.Equals("red"))
            {
                obj.GetComponent <FogOfWarEntity>().faction = FogOfWar.Players.Player00;
            }
            else if (team.Equals("blue"))
            {
                obj.GetComponent <FogOfWarEntity>().faction = FogOfWar.Players.Player01;
            }
            obj.SetActive(false);
            tempList.Add(obj);
            switch (type)
            {
            case "W":
                obj.GetComponent <AsheW>().mySkill = this;
                break;
            }
        }
        SkillObj[type].InsertRange(0, tempList);
    }