23 lines
550 B
C#
23 lines
550 B
C#
|
|
using System;
|
||
|
|
using UniRx;
|
||
|
|
using UniRx.Triggers;
|
||
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.UI;
|
||
|
|
|
||
|
|
namespace MyGame.Scripts
|
||
|
|
{
|
||
|
|
[RequireComponent(typeof(Animator))]
|
||
|
|
public class AnimationButton : MonoBehaviour
|
||
|
|
{
|
||
|
|
private static readonly int Active = Animator.StringToHash("Active");
|
||
|
|
|
||
|
|
private void Start()
|
||
|
|
{
|
||
|
|
var animator = GetComponent<Animator>();
|
||
|
|
gameObject.OnEnableAsObservable().Subscribe(_ =>
|
||
|
|
{
|
||
|
|
animator.SetTrigger(Active);
|
||
|
|
}).AddTo(this);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|