// Create FCSound component void CreateFCSound() { // Create FCSound if (m_Sound == null) { m_Sound = this.GetComponent <FCSound>(); } if (m_Sound == null) { m_Sound = this.gameObject.AddComponent <FCSound>(); } m_Sound.CreateAudioSource(); //m_Sound.enabled = true; }
// Get FCSound object public FCSound getSound() { if (m_Sound != null) { if (m_Sound.enabled == false) { return(null); } } else { m_Sound = this.GetComponent <FCSound>(); } return(m_Sound); }
// Use this for initialization void Start() { #if USE_DOTWEEN // use DOTween: https://www.assetstore.unity3d.com/en/#!/content/27676 Documentation: http://dotween.demigiant.com/documentation.php // DOTWEEN INITIALIZATION // Initialize DOTween (needs to be done only once). // If you don't initialize DOTween yourself, // it will be automatically initialized with default values. // DOTween.Init(false, true, LogBehaviour.ErrorsOnly); #elif USE_HOTWEEN // use HOTween: https://www.assetstore.unity3d.com/#/content/3311 Documentation: http://hotween.demigiant.com/documentation.html // HOTWEEN INITIALIZATION // Must be done only once, before the creation of your first tween // (you can skip this if you want, and HOTween will be initialized automatically // when you create your first tween - using default values) HOTween.Init(true, true, true); #elif USE_LEANTWEEN // use LeanTween: https://www.assetstore.unity3d.com/#/content/3595 Documentation: http://dentedpixel.com/LeanTweenDocumentation/classes/LeanTween.html #else // use iTween: https://www.assetstore.unity3d.com/#/content/84 Documentation: http://itween.pixelplacement.com/documentation.php #endif if (Application.isPlaying == true) { // Add mesh collider and make it fit to the chest if (m_CreateBoxCollider == true) { AddFitSizeBoxCollider(); //SimpleConsole.print(this.name + ":AddFitSizeBoxCollider"); } } // Get First Chest objects m_Lid = getLid(); m_Prop = getProp(); m_PropParticle = getPropParticle(); m_ChestParticle = getChestParticle(); m_Sound = getSound(); #if UNITY_EDITOR // Update in editor mode if (Application.isPlaying == false) { CreateFCLid(); CreateFCProp(); CreateFCPropParticle(); CreateFCChestParticle(); CreateFCSound(); } #endif }