private void AssignParts() { weaponStand = GetComponent <WeaponStand> (); Transform prefab = transform.GetChild(0); for (int i = 0; i < prefab.childCount; i++) { if (prefab.GetChild(i).name == "AxeStand") { weaponStand.stand = prefab.GetChild(i).transform; } else if (prefab.GetChild(i).name == "AudioSource") { myAudio = prefab.GetChild(i).GetComponent <AudioSource> (); } } for (int i = 0; i < weaponStand.stand.childCount; i++) { if (weaponStand.stand.GetChild(i).name == "AxeHandle") { axeHandle = weaponStand.stand.GetChild(i).transform; break; } } InspectorUpdate(); }
private void AssignParts() { weaponStand = GetComponent <WeaponStand> (); Transform prefab = transform.GetChild(0); for (int i = 0; i < prefab.childCount; i++) { if (prefab.GetChild(i).name == "Shooter_Stand") { weaponStand.stand = prefab.GetChild(i).transform; break; } } for (int i = 0; i < weaponStand.stand.childCount; i++) { if (weaponStand.stand.GetChild(i).name == "Shooter_Barrel") { barrel = weaponStand.stand.GetChild(i).transform; break; } } InspectorUpdate(); }
public void OnEnable() { weaponStand = (WeaponStand)target; }