void Start() { m_cLoadData = GameObject.Find("LoadData").GetComponent <C_LOADDATA>(); m_cLoadBullet = new C_LOADBULLET(); m_cLoadBullet.init(); m_cLoadAura = new C_LOADAURA(); m_cLoadAura.init(); m_goCharacter = Instantiate((GameObject)Resources.Load("Tower/Custom/customizingTower")); m_goCharacter.transform.Translate(new Vector3(0.0f, -1.0f, 0.0f)); m_mtrCharacterMaterial = m_goCharacter.transform.GetChild(1).gameObject.GetComponent <Renderer>(); m_goCharacter.tag = "CustomTower"; m_goHand = m_goCharacter.transform.GetChild(0).GetChild(1).GetChild(0).GetChild(2).GetChild(0).GetChild(2).GetChild(0).GetChild(0).GetChild(0).GetChild(0).gameObject; m_goFace = m_goCharacter.transform.GetChild(0).GetChild(1).GetChild(0).GetChild(2).GetChild(0).GetChild(0).GetChild(1).gameObject; m_goHair = m_goCharacter.transform.GetChild(0).GetChild(1).GetChild(0).GetChild(2).GetChild(0).GetChild(0).GetChild(2).gameObject; m_nHairItemNumber = -1; m_nHandItemNumber = -1; m_nFaceItemNumber = -1; m_nMaterielNumber = 0; m_nHairMaterielNumber = m_cLoadData.getLoadItem().getHairMaterialCustom(); m_goAura = new GameObject(); m_goAura.name = "Aura"; m_goBullet = new GameObject(); m_goBullet.name = "Bullet"; m_nAuraNum = (int)C_LOADAURA.E_AURAEFFECT.E_ARCANE; m_nBulletNum = 0; m_goTmpBullet = Instantiate(m_cLoadBullet.getBullet(m_nBulletNum), m_goCharacter.transform.position + new Vector3(3.0f, 1.0f, 0.0f), Quaternion.Euler(-90.0f, 0.0f, 0.0f)); m_goTmpBullet.transform.parent = m_goBullet.transform; m_goTmpAura = Instantiate(m_cLoadAura.getTowerAuraEffect((C_LOADAURA.E_AURAEFFECT)m_nAuraNum), m_goCharacter.transform.position, Quaternion.Euler(-90.0f, 0.0f, 0.0f)) as GameObject; m_goTmpAura.transform.parent = m_goAura.transform; m_nHairColorNum = 0; m_nBulletColor = 0; }
public void setMaterial(int nIndex) { m_mtrCharacterMaterial.material = m_cLoadData.getLoadItem().getLoadMaterial(nIndex); m_nMaterielNumber = nIndex; Debug.Log(nIndex); }
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; }