public virtual void OnEnable() { targetBase = (EF_Base_Weapon)target; editorSkin = EF_Editor_Utils.GetInspectorEditorUI(); EditorApplication.update += Update; }
private static void CreateWeapon(EF_WeaponType aType, GameObject aGo) { if (aGo) { //Make sure it isnt a Weapon already EF_Base_Weapon curWeapon = aGo.GetComponent <EF_Base_Weapon>(); if (curWeapon) { return; } //Lets create a new weapon switch (aType) { case EF_WeaponType.Single: aGo.AddComponent <EF_SingleFire_Weapon>(); break; case EF_WeaponType.RapidFire: aGo.AddComponent <EF_RapidFire_Weapon>(); break; case EF_WeaponType.Projectile: aGo.AddComponent <EF_ProjectileFire_Weapon>(); break; default: break; } //Set some presets AudioSource aSource = aGo.GetComponent <AudioSource>(); if (aSource) { aSource.playOnAwake = false; } } }