59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class HeroTrigger : MonoBehaviour
|
|
{
|
|
public LightWave wave1;
|
|
public LightWave wave2;
|
|
public Animator animator;
|
|
public HeroMovement heroMovement;
|
|
private bool _fired = false;
|
|
|
|
public void Reset() { _fired = false; }
|
|
|
|
void Update()
|
|
{
|
|
if (_fired) return;
|
|
if (transform.position.z >= 0f)
|
|
{
|
|
_fired = true;
|
|
heroMovement.StopMoving();
|
|
bool isView2 = GameManager.Instance != null && GameManager.Instance.isView2;
|
|
bool isSimulation = GameManager.Instance != null && GameManager.Instance.isSimulation;
|
|
if (isView2)
|
|
StartCoroutine(LaunchView2());
|
|
else
|
|
StartCoroutine(LaunchView1(isSimulation));
|
|
}
|
|
}
|
|
|
|
IEnumerator LaunchView1(bool isSimulation)
|
|
{
|
|
if (isSimulation)
|
|
{
|
|
wave1.StartWave();
|
|
yield return new WaitForSeconds(0.5f);
|
|
wave2.StartWave();
|
|
yield return new WaitForSeconds(1f);
|
|
}
|
|
else
|
|
{
|
|
wave1.StartWave();
|
|
wave2.StartWave();
|
|
yield return new WaitForSeconds(1f);
|
|
}
|
|
animator.SetTrigger("Fall");
|
|
}
|
|
|
|
IEnumerator LaunchView2()
|
|
{
|
|
wave1.StartWave();
|
|
wave2.StartWave();
|
|
wave1.showBothTextsAtOnce = true;
|
|
wave1.wave2ref = wave2;
|
|
wave1.ShowTextForBoth();
|
|
yield return new WaitForSeconds(0.1f);
|
|
animator.SetTrigger("Fall");
|
|
}
|
|
} |