/// <summary> /// Only use this when copying existing gameobjects /// Use copyInitialization() for copies of /// existing gameobjects /// </summary> public virtual void copyInitialization() { for (int i = 0; i < canonMountCapacity; i++) { Weapons_Base wScript = canonMounted[i].GetComponent <Weapons_Base>(); Player_Charactor hScript = GameObject.Find("ARCamera").GetComponent <Player_Charactor>(); wScript.forceStart(); for (int j = 0; j < hScript.hangar.canonTypes.Count; j++) { if (hScript.hangar.canonTypes[j] == canonTypes[i]) { wScript.setUpStates(hScript.hangar.canonUpgrade1[j], hScript.hangar.canonUpgrade2[j], hScript.hangar.canonUpgrade3[j]); wScript.canShoot = true; } } } mountMagasinCapacity1 = canonMounted[0].GetComponent <Weapons_Base>().weaponCapacity() * 2; if (canonMountCapacity > 2) { mountMagasinCapacity2 = canonMounted[2].GetComponent <Weapons_Base>().weaponCapacity() * 2; } shipInGameHealth = shipHealth(); shipInGameShield = shipShield(); }
public override void initializeCanon(Transform scale, int i) { canonMounted[i] = (GameObject)Object.Instantiate(Resources.Load(canonTypes[i])); Transform thisTrans = canonMounted[i].transform; //canonMounted[i].transform.localScale = new Vector3(thisTrans.localScale.x * scale.localScale.x ,thisTrans.localScale.y * scale.localScale.y , thisTrans.localScale.z * scale.localScale.z); canonMounted[i].transform.position = canonMount[i].position; canonMounted[i].transform.rotation = canonMount[i].rotation; canonMounted[i].transform.parent = canonMount[i].transform; Weapons_Base wScript = canonMounted[i].GetComponent <Weapons_Base>(); Player_Charactor hScript = GameObject.Find("ARCamera").GetComponent <Player_Charactor>(); wScript.forceStart(); for (int j = 0; j < hScript.hangar.canonTypes.Count; j++) { if (hScript.hangar.canonTypes[j] == canonTypes[i]) { wScript.setUpStates(hScript.hangar.canonUpgrade1[j], hScript.hangar.canonUpgrade2[j], hScript.hangar.canonUpgrade3[j]); } } }