Exemplo n.º 1
0
    /// <summary>
    /// 破碎时调用
    /// </summary>
    public virtual void Break()
    {
        Active = false;
        Animation.Play(AnimBreak.name);
        //动画时间长度
        float end = Animation[AnimBreak.name].length;

        for (int i = 0; Emitters != null && i < Emitters.Length; i++)
        {
            InteractionParticle ip = Emitters[i];
            MissionZone.Instance.StartCoroutine(PlayParticle(ip.Emitter, ip.Delay, ip.Life));

            if (end < ip.Delay + ip.Life)
            {
                end = ip.Delay + ip.Life;
            }

            if (ip.LinkOnRoot)
            {
                ip.Emitter.transform.parent = Root;
            }
        }

        for (int i = 0; Sounds != null && i < Sounds.Length; i++)
        {
            InteractionSound sound = Sounds[i];
            MissionZone.Instance.StartCoroutine(PlaySound(sound.Audio, sound.Delay, sound.Life));

            if (end < sound.Delay + sound.Life)
            {
                end = sound.Delay + sound.Life;
            }

            if (sound.Parent)
            {
                sound.Audio.transform.parent = sound.Parent;
            }
        }

        Invoke("OnDone", end + 0.1f);
        OnStart();
    }
Exemplo n.º 2
0
    protected void OnInteractionStart()
    {
        if (ActiveEffect)
        {
            ;
        }
        //ActiveEffect.Play(false);

        if (CameraAnimation)
        {
            CameraBehaviour.Instance.PlayCameraAnim(CameraAnimation.name, true, true);
        }

        for (int i = 0; Emitters != null && i < Emitters.Length; i++)
        {
            InteractionParticle ip = Emitters[i];
            MissionZone.Instance.StartCoroutine(PlayParticle(ip.Emitter, ip.Delay, ip.Life));


            if (ip.LinkOnRoot)
            {
                ip.Emitter.transform.parent = GetEntryTransform();
            }
        }

        for (int i = 0; Sounds != null && i < Sounds.Length; i++)
        {
            InteractionSound sound = Sounds[i];
            MissionZone.Instance.StartCoroutine(PlaySound(sound.Audio, sound.Delay, sound.Life));

            if (sound.Parent)
            {
                sound.Audio.transform.parent = sound.Parent;
            }
        }

        for (int i = 0; ObjectsToShow != null && i < ObjectsToShow.Length; i++)
        {
            ObjectsToShow[i].SetActive(true);
        }
    }
Exemplo n.º 3
0
 void Awake()
 {
     instance    = this;
     audioSource = this.GetComponent <AudioSource>();
 }