Files
modular-vr/Assets/Station46/Modules/Hoop/Scripts/ButtonHoop.cs

35 lines
997 B
C#

using Station46.Modules.Holes.Scripts;
using Station46.Scripts;
using UnityEngine;
namespace Station46.Modules.Hoop.Scripts
{
[RequireComponent(typeof(Animator))]
public class ButtonHoop : Hole
{
private static readonly int PressedHash = Animator.StringToHash("Pressed");
private Animator _animator;
protected override void Start()
{
base.Start();
_animator = GetComponent<Animator>();
ButtonEvent += (_, type) =>
{
// ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault
switch (type)
{
case ButtonEventType.Pressed:
_animator.SetBool(PressedHash, true);
break;
case ButtonEventType.Released:
_animator.SetBool(PressedHash, false);
break;
}
};
}
}
}