Пример #1
0
        private void TriggerTapEvent()
        {
            Debug.Log("-----" + CurrentSelectable.transform.name);
            LeanFingerTap leanFingerTap = CurrentSelectable.transform.GetComponent <LeanFingerTap> ();

            if (leanFingerTap)
            {
                leanFingerTap.HandleTap();
            }
        }
Пример #2
0
        //public LeanFingerEvent OnFingerTap;

        public void HandleTap()
        {
            //EventManager.TriggerEvent (transform.name);

            //return;
            if (modelType.Equals("Animator"))
            {
                if (!isAnimatorLoaded)
                {
                    Debug.Log("LeanFingerTap isAnimatorLoaded load Animator");
                    animator = this.gameObject.GetComponent <Animator> ();

                    if (animator != null)
                    {
                        isAnimatorLoaded = true;
                        Debug.Log("LeanFingerTap isAnimatorLoaded Animator load success");
                    }
                }
                AnimatorStateInfo stateinfo = animator.GetCurrentAnimatorStateInfo(0);

                if (animator != null && !stateinfo.IsName("Base Layer.Take003"))
                {
                    //animator.Play ();
                    //animator.Play ("Take002");
                    //animator.SetTrigger ("Animation");
                    animator.Play("Take 003");
                    Debug.Log(this.gameObject.name + " " + "animation");
                    ParticleSystem ps = GetTypeParticle(transform, "Tap_Particle");
                    if (ps)
                    {
                        ps.Play();
                    }
                }
                else
                {
                    Debug.Log("animation error");
                }
            }

            AudioSource audioSource = this.gameObject.GetComponentInChildren <AudioSource> (true);

            if (audioSource)
            {
                audioSource.Play();
            }

            //------------------MiTu test eat apple
            if (modelType.Equals("MultiPart"))
            {
                LeanFingerTap fingerTap = this.gameObject.GetComponent <LeanFingerTap> ();
                if (fingerTap)
                {
                    fingerTap.enabled = false;
                    Debug.Log("tap disable success;");
                }
                // Disable rendering:
                Utility.HideRendererAndCollider(this.transform);

                if (nextARObject)
                {
                    LeanFingerTap nextObjFingerTap = nextARObject.GetComponentInChildren <LeanFingerTap> (true);
                    if (nextObjFingerTap)
                    {
                        nextObjFingerTap.enabled = true;
                        Debug.Log("tap enable success;");
                    }
                    //show nextgameobject render and collider
                    Utility.ShowRendererAndCollider(nextARObject.transform);
                }
                else
                {
                    Utility.LogPrint("go not exist" + this.gameObject.name);
                }
            }
            //------------------
            Debug.Log(this.gameObject.name + " " + "taped");
        }