71 lines
2.4 KiB
C#
71 lines
2.4 KiB
C#
using UnityEngine;
|
|
using DG.Tweening;
|
|
using asap.core;
|
|
using Game;
|
|
|
|
public class EventOfferJourneyShellPointPathView : MonoBehaviour
|
|
{
|
|
[SerializeField] private GameObject darkPoint01, darkPoint02, lightPoint01, lightPoint02;
|
|
private float _showDuration, _gapDuration;
|
|
|
|
public void Init(float showDuration = 0.25f, float gapDuration = 1 / 12f)
|
|
{
|
|
_showDuration = showDuration;
|
|
_gapDuration = gapDuration;
|
|
}
|
|
|
|
private void Reset()
|
|
{
|
|
darkPoint01 = transform.Find("point_01_dark").gameObject;
|
|
darkPoint02 = transform.Find("point_02_dark").gameObject;
|
|
lightPoint01 = transform.Find("point_01_light").gameObject;
|
|
lightPoint02 = transform.Find("point_02_light").gameObject;
|
|
}
|
|
|
|
public void Hide()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
public void SetDark()
|
|
{
|
|
darkPoint01.SetActive(true);
|
|
darkPoint02.SetActive(true);
|
|
lightPoint01.SetActive(false);
|
|
lightPoint02.SetActive(false);
|
|
gameObject.SetActive(true);
|
|
}
|
|
|
|
public void SetLight()
|
|
{
|
|
darkPoint01.SetActive(false);
|
|
darkPoint02.SetActive(false);
|
|
lightPoint01.SetActive(true);
|
|
lightPoint02.SetActive(true);
|
|
lightPoint01.transform.localScale = Vector3.one;
|
|
lightPoint02.transform.localScale = Vector3.one;
|
|
gameObject.SetActive(true);
|
|
}
|
|
|
|
public async System.Threading.Tasks.Task Play()
|
|
{
|
|
darkPoint01.SetActive(true);
|
|
darkPoint02.SetActive(true);
|
|
lightPoint01.SetActive(true);
|
|
lightPoint02.SetActive(true);
|
|
lightPoint01.transform.localScale = Vector3.forward;
|
|
lightPoint02.transform.localScale = Vector3.forward;
|
|
gameObject.SetActive(true);
|
|
await Awaiters.NextFrame;
|
|
GContext.Publish(new EventUISound("audio_ui_offerjourneyshell_light"));
|
|
// Debug.Log("[EventOfferJourney] sfx1");
|
|
await lightPoint01.transform.DOScale(Vector3.one, _showDuration).AsyncWaitForCompletion();
|
|
// Debug.Log($"[EventOfferJourney] gap: {_gapDuration}");
|
|
// Debug.Log($"[EventOfferJourney] show: {_showDuration}");
|
|
await System.Threading.Tasks.Task.Delay(System.TimeSpan.FromSeconds(_gapDuration));
|
|
GContext.Publish(new EventUISound("audio_ui_offerjourneyshell_light"));
|
|
// Debug.Log("[EventOfferJourney] sfx2");
|
|
await lightPoint02.transform.DOScale(Vector3.one, _showDuration).AsyncWaitForCompletion();
|
|
}
|
|
}
|