// Toggle Lock/Unlock public void ToggleLock() { if (m_Lid == null) { m_Lid = getLid(); } if (m_Lid != null) { if (m_Lid.enabled == true) { // Lock/Unlock only when Chest is closed if (m_Lid.IsOpeningOrClosing() == false) { // Switch to Lock if (m_Lid.IsLocked() == false) { m_Lid.Lock(); } // Switch to Unlock else { m_Lid.Unlock(); } } } } }
// ######################################## // Open/Close Functions // ######################################## #region Open/Close Functions // Toggle Open/Close public void ToggleOpen() { if (m_Lid == null) { m_Lid = getLid(); } if (m_Lid != null) { if (m_Lid.enabled == true) { // Open/Close when the Lid is not turning if (m_Lid.IsOpeningOrClosing() == false) { // Close if (m_Lid.IsOpened()) { Close(); } // Open else { Open(); } } } } }
// ######################################## // Create FirstChest components functions // ######################################## #region Create FirstChest components functions #if UNITY_EDITOR // Create FCLid component void CreateFCLid() { // Create FCLid if (m_Lid == null) { m_Lid = this.GetComponent <FCLid>(); } if (m_Lid == null) { m_Lid = this.gameObject.AddComponent <FCLid>(); } //m_Lid.enabled = true; m_Lid.FindLid(); }
// ######################################## // Get Funtions // ######################################## #region Get Funtions // Get FCLid object public FCLid getLid() { if (m_Lid != null) { if (m_Lid.enabled == false) { return(null); } } else { m_Lid = this.GetComponent <FCLid>(); } return(m_Lid); }
// 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 }