示例#1
0
    private void upgradeTowerData(GameObject goTower, int nListIndex)
    {
        //goTower.transform.GetChild(1).GetComponent<Renderer>().material
        //    = m_cLoadData.getLoadItem().getLoadMaterial((int)m_cLoadData.getLoadCustomTower().getWantData((int)C_LOADCUSTOMTOWER.E_LISTORDER.E_CLOTH, nListIndex));

        goTower.transform.GetChild(1).GetComponent <Renderer>().material
            = m_cLoadData.getLoadItem().getLoadMaterial((int)m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_CLOTH));


        GameObject m_goHand = goTower.transform.GetChild(0).GetChild(1).GetChild(0).GetChild(2).GetChild(0).GetChild(2).GetChild(0).GetChild(0).GetChild(0).GetChild(0).gameObject;
        GameObject m_goFace = goTower.transform.GetChild(0).GetChild(1).GetChild(0).GetChild(2).GetChild(0).GetChild(0).GetChild(1).gameObject;
        GameObject m_goHair;

        if (nListIndex == (int)C_LOADCUSTOMTOWER.E_LISTTOWERNUM.E_CRIS1 && nListIndex == (int)C_LOADCUSTOMTOWER.E_LISTTOWERNUM.E_CRIS2 &&
            nListIndex == (int)C_LOADCUSTOMTOWER.E_LISTTOWERNUM.E_CRIS3 && nListIndex == (int)C_LOADCUSTOMTOWER.E_LISTTOWERNUM.E_CRIS4)
        {
            m_goHair = goTower.transform.GetChild(0).GetChild(1).GetChild(0).GetChild(2).GetChild(0).GetChild(0).GetChild(2).gameObject;
        }
        else
        {
            m_goHair = goTower.transform.GetChild(0).GetChild(1).GetChild(0).GetChild(2).GetChild(0).GetChild(0).GetChild(1).gameObject;
        }


        if (m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_FACE) < 2)
        {
            //GameObject goTmpFace = Instantiate(m_cLoadData.getLoadItem().getLoadFace((int)m_cLoadData.getLoadCustomTower().getList(nListIndex)[(int)C_LOADCUSTOMTOWER.E_LISTORDER.E_FACE])
            //    , goTower.transform.position, Quaternion.Euler(new Vector3(-90.0f, 0.0f, 0.0f)));
            GameObject goTmpFace = Instantiate(m_cLoadData.getLoadItem().getLoadFace((int)m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_FACE))
                                               , goTower.transform.position, Quaternion.Euler(new Vector3(-90.0f, 0.0f, 0.0f)));
            goTmpFace.transform.parent = m_goFace.transform;
        }

        if (m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_HEAD) < 5)
        {
            GameObject goTmpHair;
            if (nListIndex == (int)C_LOADCUSTOMTOWER.E_LISTTOWERNUM.E_SOLIDER1 || nListIndex == (int)C_LOADCUSTOMTOWER.E_LISTTOWERNUM.E_SOLIDER2 ||
                nListIndex == (int)C_LOADCUSTOMTOWER.E_LISTTOWERNUM.E_SOLIDER3 || nListIndex == (int)C_LOADCUSTOMTOWER.E_LISTTOWERNUM.E_SOLIDER4 ||
                m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_HEAD) == 4)
            {
                //goTmpHair = Instantiate(m_cLoadData.getLoadItem().getLoadHair((int)m_cLoadData.getLoadCustomTower().getList(nListIndex)[(int)C_LOADCUSTOMTOWER.E_LISTORDER.E_HEAD])
                //, m_goHair.transform.position, Quaternion.Euler(new Vector3(0.0f, 0.0f, 0.0f)));
                goTmpHair = Instantiate(m_cLoadData.getLoadItem().getLoadHair((int)m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_HEAD))
                                        , m_goHair.transform.position, Quaternion.Euler(new Vector3(0.0f, 0.0f, 0.0f)));

                if (m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_HEADMATERIAL) != 16)
                {
                    goTmpHair.transform.GetChild(1).GetComponent <Renderer>().materials[1].color = m_cLoadData.getLoadItem().getLoadHairMaterial((int)(m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_HEADMATERIAL))).color;

                    if (m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_HAIRCOLOR) != 0)
                    {
                        goTmpHair.transform.GetChild(1).GetComponent <Renderer>().materials[1].color = intChangeColor(m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_HAIRCOLOR));
                    }
                }
                goTmpHair.transform.parent = m_goHair.transform;
            }
            else
            {
                // goTmpHair = Instantiate(m_cLoadData.getLoadItem().getLoadHair((int)m_cLoadData.getLoadCustomTower().getList(nListIndex)[(int)C_LOADCUSTOMTOWER.E_LISTORDER.E_HEAD])
                //, goTower.transform.GetChild(1).position, Quaternion.Euler(new Vector3(-90.0f, 0.0f, 0.0f)));
                goTmpHair = Instantiate(m_cLoadData.getLoadItem().getLoadHair((int)m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_HEAD))
                                        , goTower.transform.GetChild(1).position, Quaternion.Euler(new Vector3(-90.0f, 0.0f, 0.0f)));

                if (m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_HEADMATERIAL) != 17)
                {
                    goTmpHair.GetComponent <Renderer>().material = m_cLoadData.getLoadItem().getLoadHairMaterial((int)m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_HEADMATERIAL));

                    Debug.Log(m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_HAIRCOLOR));

                    goTmpHair.GetComponent <Renderer>().material.color = intChangeColor(m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_HAIRCOLOR));
                }
                goTmpHair.transform.parent = m_goHair.transform;
            }
        }

        if ((int)m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_WEAPON) < 2)
        {
            GameObject goTmpWeapon = Instantiate(m_cLoadData.getLoadItem().getLoadWeapon((int)m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_WEAPON))
                                                 , m_goHand.transform.position, m_goHand.transform.rotation);

            goTmpWeapon.transform.parent = m_goHand.transform;
        }
        goTower.name = "Tower" + m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_ID);

        goTower.AddComponent <C_CUSTOMTOWER>();
        goTower.AddComponent <C_TOWER>();

        goTower.AddComponent <C_TOWERANIMATION>();
        goTower.GetComponent <Animation>().enabled = true;
        goTower.AddComponent <C_TOWERUI>();

        goTower.GetComponent <C_CUSTOMTOWER>().setBullet(m_cLoadData.getLoadBullet().getBullet((int)m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_BULLET)));
        goTower.GetComponent <C_CUSTOMTOWER>().setBulletColor(m_cLoadData.getLoadBullet().getBulletMaterial((int)m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_BULLETCOLOR)));


        goTower.GetComponent <C_CUSTOMTOWER>().init(//gameObject.GetComponent<C_TOWERUPGRADE>().getAttacking((int)m_cLoadData.getLoadCustomTower().getList(nListIndex)[(int)C_LOADCUSTOMTOWER.E_LISTORDER.E_BULLET])
            m_cTowerUpgrade.getAttacking(nListIndex)
            , m_cLoadData.getLoadCustomTower().getWantFTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERFLOAT.E_DOWNRANGE)
            , m_cLoadData.getLoadCustomTower().getWantFTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERFLOAT.E_SPEEDOFSTRIKING)
            , (int)m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_TARGETCOUNT),
            nListIndex);

        GameObject goTmpEffect = Instantiate(m_cLoadData.getLoadAura().getTowerAuraEffect(
                                                 (C_LOADAURA.E_AURAEFFECT)(int) m_cLoadData.getLoadCustomTower().getWantNTowerData(nListIndex, C_LOADTOWERDATA.E_LISTORDERINT.E_AURA))
                                             , goTower.transform.position + new Vector3(0.0f, 0.53f, 0.0f), Quaternion.Euler(-90.0f, 0.0f, 0.0f)) as GameObject;

        goTmpEffect.transform.parent = goTower.transform;
    }
示例#2
0
 public int getTowerCount()
 {
     return(m_cLoadData.getLoadCustomTower().getTowerCount());
 }