You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.3 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SnowFlakeLogo : SnowFlake
{
[AutoUI] public float AppearTime = 3;
[SerializeField] private float _appearTimer;
public const string DisnyLogo = "DisnyLogo";
private RawImage _image;
// Start is called before the first frame update
new void Awake()
{
base.Awake();
_image = GetComponent<RawImage>();
}
// Update is called once per frame
new void Update()
{
base.Update();
if (IsPlay)
CheckLogoTime();
}
void CheckLogoTime()
{
var infoState = _animator.GetCurrentAnimatorStateInfo(0);
if (infoState.normalizedTime < 1)
return;
if(infoState.IsName(DisnyLogo))
{
_appearTimer -= Time.deltaTime;
if(_appearTimer < 0)
{
_animator.SetTrigger("Fade");
}
}
}
public override void CheckPlayEnd()
{
if (_animator.GetCurrentAnimatorStateInfo(0).IsName(End))
{
_image.enabled = false;
Reset();
}
}
public override void Play()
{
base.Play();
_appearTimer = AppearTime;
_image.color = Color.white;
_image.enabled = true;
}
}