using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
namespace Snxxz.UI
|
{
|
public class TreasurePotentialLines : MonoBehaviour
|
{
|
[SerializeField] UIEffect[] m_Lines;
|
[SerializeField] RectTransform[] m_Targets;
|
|
public void Display(int _index, bool _open)
|
{
|
m_Lines[_index].StopImediatly();
|
if (_open)
|
{
|
StartCoroutine(Co_Display(_index));
|
}
|
}
|
|
IEnumerator Co_Display(int _index)
|
{
|
yield return null;
|
m_Lines[_index].Play();
|
var animator = m_Lines[_index].target.GetAnimator();
|
var _frompos = transform.InverseTransformPoint(m_Targets[_index].transform.TransformPoint(Vector3.zero));
|
var _angle = VectorUtility.VectorAngle(Vector3.zero, _frompos);
|
m_Lines[_index].transform.localEulerAngles = Vector3.zero.SetZ(_angle);
|
animator.transform.localScale = Vector3.one.SetY(Vector2.Distance(_frompos, Vector3.zero)
|
/ TreasureAnimation.LINE_NORMAL_LENGTH * TreasureAnimation.LINE_NORMAL_SCALE);
|
animator.Play(TreasureAnimation.POTENTIAL_LINE_STATE_2, 0, 0);
|
}
|
|
public void Dispose()
|
{
|
for (int i = 0; i < m_Lines.Length; i++)
|
{
|
m_Lines[i].StopImediatly();
|
}
|
}
|
}
|
}
|