Esempio n. 1
0
    public void CreateTower()
    {
        m_goMyTower = Instantiate((GameObject)Resources.Load("Tower/Custom/customizingTower"));

        m_goMyTower.transform.GetChild(1).GetComponent <Renderer>().material = m_cLoadItem.getLoadMaterial(m_nMtrCustom);

        GameObject m_goHand = m_goMyTower.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 = m_goMyTower.transform.GetChild(0).GetChild(1).GetChild(0).GetChild(2).GetChild(0).GetChild(0).GetChild(1).gameObject;
        GameObject m_goHair = m_goMyTower.transform.GetChild(0).GetChild(1).GetChild(0).GetChild(2).GetChild(0).GetChild(0).GetChild(2).gameObject;

        if (m_nFace != -1)
        {
            GameObject goTmpFace = Instantiate(m_cLoadItem.getLoadFace(m_nFace), m_goMyTower.transform.position, Quaternion.Euler(new Vector3(-90.0f, 0.0f, 0.0f)));

            goTmpFace.transform.parent = m_goFace.transform;
        }
        if (m_nHair != -1)
        {
            GameObject goTmpHair = Instantiate(m_cLoadItem.getLoadHair(m_nHair), m_goMyTower.transform.GetChild(1).position, Quaternion.Euler(new Vector3(-90.0f, 0.0f, 0.0f)));

            goTmpHair.GetComponent <Renderer>().material = m_cLoadItem.getLoadHairMaterial(PlayerPrefs.GetInt("HairMaterielNumber"));

            goTmpHair.transform.parent = m_goHair.transform;
        }
        if (m_nWeapon != -1)
        {
            GameObject goTmpWeapon = Instantiate(m_cLoadItem.getLoadWeapon(m_nWeapon), m_goHand.transform.position, m_goHand.transform.rotation);

            goTmpWeapon.transform.parent = m_goHand.transform;
        }

        m_goMyTower.AddComponent <C_CUSTOMTOWER>();
        m_goMyTower.AddComponent <C_TOWER>();
        m_goMyTower.AddComponent <C_TOWERUI>();
        m_goMyTower.AddComponent <C_TOWERANIMATION>();
        m_goMyTower.GetComponent <Animation>().enabled = true;

        m_goMyTower.AddComponent <C_CUSTOMTOWER>().setBullet(m_cLoadBullet.getBullet(PlayerPrefs.GetInt("bullet")));
        m_goMyTower.AddComponent <C_CUSTOMTOWER>().init(PlayerPrefs.GetFloat("striking", 0.0f), PlayerPrefs.GetFloat("downrange", 0.0f)
                                                        , PlayerPrefs.GetFloat("speedOfStriking", 0.0f), PlayerPrefs.GetInt("targetCount", 0), 25);



        GameObject goTmpEffect = Instantiate(m_cLoadAura.getTowerAuraEffect((C_LOADAURA.E_AURAEFFECT)PlayerPrefs.GetInt("aura")), m_goMyTower.transform.position, Quaternion.Euler(-90.0f, 0.0f, 0.0f)) as GameObject;

        //m_goMyTower.AddComponent<C_CUSTOMTOWER>().setBullet(GameObject.Find("BulletnAura").GetComponent<C_AURABULLETBUTTON>().getBulletNum());

        //GameObject goTmpEffect = Instantiate(GameObject.Find("BulletnAura").GetComponent<C_AURABULLETBUTTON>().getAuraNum(), m_goMyTower.transform.position, Quaternion.Euler(-90.0f, 0.0f, 0.0f)) as GameObject;

        goTmpEffect.transform.parent = m_goMyTower.transform;
        GameObject.Find("Cus").GetComponent <C_CUSTOMIZINGCLOTH>().getCharacter().SetActive(false);
    }
Esempio n. 2
0
    void Start()
    {
        m_cLoadItem = new C_LOADITEM();
        m_cLoadItem.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_goCharacter.SetActive(false);

        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           = -1;
        m_mtrCharacterMaterial.material = m_cLoadItem.getLoadMaterial(m_nMaterielNumber);
    }
Esempio n. 3
0
 public void setMaterial(int nIndex)
 {
     m_mtrCharacterMaterial.material = m_cLoadItem.getLoadMaterial(nIndex);
     m_nMaterielNumber = nIndex;
     Debug.Log(nIndex);
 }