add mirror
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Zenject;
|
||||
using DG.Tweening;
|
||||
using UltraFace;
|
||||
|
||||
public class MirrorAnimationHandler : MonoBehaviour
|
||||
{
|
||||
[Inject] private Visualizer _visualizer;
|
||||
[SerializeField] private Material _material;
|
||||
[SerializeField] private Color _baseColor;
|
||||
|
||||
private void Start() {
|
||||
_material.color = Color.white;
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
_material.DOColor(_baseColor, 0);
|
||||
_visualizer.OnDetectionStatusChanged += isDetected =>
|
||||
{
|
||||
if(isDetected)
|
||||
{
|
||||
Debug.Log("хуй");
|
||||
|
||||
transform.DOLocalRotate(Vector3.up * (360f - 35f), 1f)
|
||||
.SetRelative()
|
||||
.SetEase(Ease.InOutSine)
|
||||
.SetLoops(1)
|
||||
.OnComplete(() => _material.DOColor(Color.white, .5f));
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.DOLocalRotate(Vector3.up * (360f + 35f), 1f)
|
||||
.SetRelative()
|
||||
.SetLoops(1)
|
||||
.SetEase(Ease.InOutSine);
|
||||
|
||||
_material.DOColor(_baseColor, .5f);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user