51 lines
No EOL
1.3 KiB
C#
51 lines
No EOL
1.3 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Start
|
|
{
|
|
public class AnimLogoCont : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
[Header("Random animation for JDLogocont item")]
|
|
private Animator _jdLogoCont = null;
|
|
|
|
[Header("Min / Max loop of the LogoLoop anim to launch randomly the other logo bim")]
|
|
[SerializeField]
|
|
private int _minNumberLoopIdleToLogoBim = 1;
|
|
[SerializeField]
|
|
private int _maxNumberLoopIdleToLogoBim = 10;
|
|
|
|
private int _numberLooped = 0;
|
|
|
|
private float _randomAnim = 0f;
|
|
|
|
private void Start()
|
|
{
|
|
_numberLooped = 0;
|
|
_randomAnimRange();
|
|
}
|
|
|
|
// Launched each time the LogoLoop animation ends by a event trigger on the anim.
|
|
public void PlayLogoBim()
|
|
{
|
|
if (_randomAnim < _numberLooped)
|
|
{
|
|
_numberLooped = 0;
|
|
_jdLogoCont.SetTrigger("LogoBim");
|
|
|
|
_randomAnimRange();
|
|
}
|
|
else
|
|
{
|
|
_numberLooped++;
|
|
}
|
|
}
|
|
|
|
private void _randomAnimRange()
|
|
{
|
|
_randomAnim = UnityEngine.Random.Range(_minNumberLoopIdleToLogoBim, _maxNumberLoopIdleToLogoBim);
|
|
}
|
|
}
|
|
} |