public static WGWeapon CreateWeapon() { Object obj = Resources.Load("pbWeapon"); if (obj != null) { GameObject go = Instantiate(obj) as GameObject; WGWeapon gun = go.GetComponent <WGWeapon>(); return(gun); } return(null); }
// public void DonotNeedCoin(float time) // { // CancelInvoke("retNeedCoin"); // bNeedCoin = false; // Invoke("retNeedCoin",time); // } // void retNeedCoin() // { // bNeedCoin = true; // } void Start() { if (dp.DelAD == 0) { Up = Up_Add; } else { Up = upTemp; } _ShareWorld = WGGameWorld.Instance; _dataCtrl = WGDataController.Instance; // for(int i=0;i<_dataCtrl.szWeapons.Count;i++) // { // WGWeapon wep = WGWeapon.CreateWeapon(i); // wep.gameObject.SetActive(false); // wep.transform.parent = this.transform; // wep.transform.localPosition = Vector3.zero; // wep.transform.localRotation = Quaternion.Euler(Vector3.zero); // wep.transform.localScale = Vector3.one; // szWeaponGO.Add(wep); // } mWeaponIndex = 0; // _Weapon = szWeaponGO[0]; _Weapon = WGWeapon.CreateWeapon(); SDK.AddChild(_Weapon.gameObject, this.gameObject); _Weapon.transform.localPosition = new Vector3(0, 0, -0.99f); // _Weapon.labCostCoin = labCostNum; _Weapon.ESetActive(true); _weaponData = _dataCtrl.szWeapons[0]; UIEventListener.Get(goEvent).onPress += this.myOnPress; CheckStaticWeapon(); }