public override void Response1() { switch (itemType) { case 'w': mods.ChangeWeapon(0, inThisShop[0]); break; case 's': mods.ChangeShield(0, inThisShop[0]); break; case 'e': mods.ChangeEngine(0, inThisShop[0]); break; default: break; } Destroy(GetComponent <RegularDeviceShop>()); Debug.Log("Changed " + inThisShop[0]); base.Response1(); }
public void LoadShipPrefabs() { if (!mods) { mods = transform.root.GetComponent <Modules>(); } for (int i = 0; i < WeaponSlotsPaths.Length; i++) { if (WeaponSlotsPaths[i].Equals("")) { Debug.Log("Weapon path is not set"); return; } GameObject wep = Resources.Load <GameObject>(basePath + WeaponSlotsPaths[i]); if (wep) { mods.ChangeWeapon(i, wep); WeaponSlotsPaths[i] = GetFullPath(wep); } else { PathError(basePath + WeaponSlotsPaths[i]); } } for (int i = 0; i < ShieldSlotsPaths.Length; i++) { if (ShieldSlotsPaths[i].Equals("")) { Debug.Log("Shield path is not set"); return; } GameObject shield = Resources.Load <GameObject>(basePath + ShieldSlotsPaths[i]); if (shield) { mods.ChangeShield(i, shield); ShieldSlotsPaths[i] = GetFullPath(shield); } else { PathError(basePath + ShieldSlotsPaths[i]); } } for (int i = 0; i < EngineSlotsPaths.Length; i++) { if (EngineSlotsPaths[i].Equals("")) { Debug.Log("Engine path is not set"); return; } GameObject eng = Resources.Load <GameObject>(basePath + EngineSlotsPaths[i]); if (eng) { mods.ChangeEngine(i, eng); ShieldSlotsPaths[i] = GetFullPath(eng); } else { PathError(basePath + EngineSlotsPaths[i]); } } }