public static Weapon[] FactoryEquipments(string[] equipmentName) { if (equipmentName != null) { Weapon[] equipments = new Weapon[equipmentName.Length]; for (int number = 0; number < equipmentName.Length; number++) { if (equipmentName[number] == "SmallLaserTest") { equipments[number] = new SmallLaserTest(); } else if (equipmentName[number] == "LargeLaserTest") { equipments[number] = new SmallLaserTest(); } else if (equipmentName[number] == "Overcharge") { Debug.Log("mount overcharge on ship"); equipments[number] = new Overcharge(); } else if (equipmentName[number] != null) { Debug.LogError("invalid weapon name"); } } return(equipments); } else { return(null); } }
private void Initialisation() { //Initialisations m_eventSystem = GameObject.Find("EventSystem").GetComponent <EventSystem>(); m_playerStats = GetComponent <PlayerStats>(); m_rigidbody = GetComponent <Rigidbody>(); m_animator = GetComponent <Animator>(); m_audioSource = GetComponent <AudioSource>(); m_steamBlastComponent = m_steamBlastObject.gameObject.GetComponent <SteamBlast>(); m_innerFireComponent = m_innerFireObject.gameObject.GetComponent <InnerFire>(); m_naturesRejuvenationComponent = m_naturesRejuvenationObject.gameObject.GetComponent <NaturesRejuvenation>(); m_livingArmorComponent = m_livingArmorObject.gameObject.GetComponent <LivingArmor>(); m_overchargeComponent = m_overchargeObject.gameObject.GetComponent <Overcharge>(); }