public virtual void startAppear(bool direct = false)
    {
        //Debug.Log("startAppear " + name + " / direct: " + direct);
        //calling appear while it's disappearing is forbidden (future update might include that it fastforward the whole current disappear)
        if (this.currentState == CSFHIAnimableState.appeared)
        {
            return;
        }

        if (this.currentState == CSFHIAnimableState.disappearing)
        {
            Debug.LogWarning("CSFHI : start appear not available if disappear in progress");
            return;
        }

        if (this.currentState != CSFHIAnimableState.appearing)
        {
            foreach (InterfaceAnmElement _element in elementsList)
            {
                if (_element && _element.isNested_IAM)
                {
                    _element.gameObjectRef.GetComponent <InterfaceAnimManager>().startDisappear(true);
                    _element.gameObjectRef.GetComponent <InterfaceAnimManager>().currentState = CSFHIAnimableState.disappeared;
                }
            }
            this.gameObject.SetActive(true);
            if (!direct && audioSource && audioSource.enabled && (this.currentState != CSFHIAnimableState.appeared && this.currentState != CSFHIAnimableState.appearing))
            {
                audioSource.clip = openSound;
                audioSource.Play();
            }
            if (direct)
            {
                foreach (InterfaceAnmElement _element in elementsList)
                {
                    if (_element)
                    {
                        _element.gameObjectRef.SetActive(true);
                        if (_element.isNested_IAM)
                        {
                            _element.gameObjectRef.GetComponent <InterfaceAnimManager>().startAppear(true);
                        }
                        _element.currentState = CSFHIAnimableState.appearing;
                    }
                }
                endAppear();
            }
            else
            {
                timer        = 0;
                currentState = CSFHIAnimableState.appearing;
            }
        }

        /*	Debug.Log("mainState "+currentState);
         * foreach (InterfaceAnmElement _element in elementsList) {
         *      Debug.Log("elementState "+_element.currentState);
         * }*/
    }
    private void endDisappear()
    {
        //Debug.Log("CSFHI : endDisappear " + name);
        foreach (InterfaceAnmElement _element in elementsList)
        {
            _element.currentState = CSFHIAnimableState.disappeared;
            if (_element.isNested_IAM)
            {
                _element.gameObjectRef.GetComponent <InterfaceAnimManager>().currentState = CSFHIAnimableState.disappeared;
            }
            _element.gameObjectRef.SetActive(false);
        }
        waitElementFullAnim = null;
        StopCoroutine(Disable_OnDisappearEnd());
        currentState = CSFHIAnimableState.disappeared;
        if (!isIAM_Root())   // if it is nested IAM
        {
            this.gameObject.SetActive(false);

            //+ if this nested IAM is the latest element to disappear of the ROOT, we use it to declare the endDisappear of the parent
            //because that element will usually be at delay 0, we need to launch endDisappear even after the original timer
            InterfaceAnimManager _parentIAM = this.transform.parent.GetComponent <InterfaceAnimManager>();
            if (_parentIAM.currentState == CSFHIAnimableState.disappearing)
            {
                //we check that the parent is the root
                if (_parentIAM.transform.parent)
                {
                    if (_parentIAM.transform.parent.GetComponent <InterfaceAnimManager>())
                    {
                        return;
                    }
                }

                int index = 0;
                foreach (InterfaceAnmElement _element in _parentIAM.elementsList)
                {
                    if (_element.gameObjectRef == this.gameObject)
                    {
                        if (index == 0)
                        {
                            _parentIAM.endDisappear();
                        }
                        return;
                    }
                    index++;
                }
            }
        }
        // Check if there are any listeners.
        if (OnEndDisappear != null)
        {
            OnEndDisappear(this);
        }
    }
 public virtual void Delete()
 {
     this.gameObjectRef = null;
     this.sortID        = 0;
     this.timeAppear    = 1;
     this.timeDisappear = 1;
     this.isNested_IAM  = false;
     this.currentState  = CSFHIAnimableState.disappeared;
     this.recycling     = true;
     //DestroyImmediate(this,false);
 }
    public virtual void startDisappear(bool _direct = false)
    {
        //Debug.Log("CSFHI : startDisappear " + name + " / direct: " + direct);
        if (this.currentState == CSFHIAnimableState.appeared)
        {
            timer = 0;
        }

        //if (this.currentState == CSFHIAnimableState.appearing)
        //    timer = disappearDelay_SpeedMultiplier - timer;
        if (this.currentState == CSFHIAnimableState.appearing)
        {
            timer = 0;
        }

        if (_direct || this.currentState != CSFHIAnimableState.disappearing)
        {
            //if we call a directDisappear OVER a notDirect Disappear, the directDisappear does override
            //if we call a disappear over an appear, the disappear does override

            // Check if there are any listeners.
            if (OnStartDisappear != null)
            {
                OnStartDisappear(this);
            }

            if (_direct)
            {
                foreach (InterfaceAnmElement _element in elementsList)
                {
                    if (_element.isNested_IAM)
                    {
                        _element.gameObjectRef.GetComponent <InterfaceAnimManager>().startDisappear(true);
                    }
                    _element.gameObjectRef.SetActive(false);
                    _element.currentState = CSFHIAnimableState.disappearing;
                }
                endDisappear();
            }
            else
            {
                if (waitAppear_Nested)
                {
                    //if their was appear, we remove the latest waitElementFullAnim
                    waitElementFullAnim = null;
                }
                currentState = CSFHIAnimableState.disappearing;
            }
        }
    }
    private void endAppear()
    {
        currentState        = CSFHIAnimableState.appeared;
        waitElementFullAnim = null;

        //doubleConfirm:
        foreach (InterfaceAnmElement _element in elementsList)
        {
            if (_element)
            {
                _element.currentState = CSFHIAnimableState.appeared;
            }
        }
        // Check if there are any listeners.
        if (OnEndAppear != null)
        {
            OnEndAppear(this);
        }
    }
 private void endAppear()
 {
     currentState        = CSFHIAnimableState.appeared;
     waitElementFullAnim = null;
 }