35 lines
861 B
C#
35 lines
861 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class TamagochiEffect : MonoBehaviour, IEffect
|
|
{
|
|
[SerializeField] ParticleSystem LOLps;
|
|
[SerializeField] AudioClip popClip;
|
|
|
|
public void Play()
|
|
{
|
|
StopAllCoroutines();
|
|
StartCoroutine(TamaWin());
|
|
}
|
|
|
|
IEnumerator TamaWin()
|
|
{
|
|
LOLps.gameObject.SetActive(true);
|
|
float startDelay = LOLps.main.startLifetime.constant;
|
|
float duration = startDelay + LOLps.main.duration;
|
|
float starttime = Time.time;
|
|
yield return new WaitForSeconds(startDelay);
|
|
|
|
while (Time.time - starttime < duration)
|
|
{
|
|
SoundManager.instance.playClip(popClip);
|
|
yield return new WaitForSeconds(1/LOLps.emission.rateOverTime.constant);
|
|
}
|
|
//LOLps.SetActive(false);
|
|
|
|
|
|
|
|
}
|
|
}
|