diff --git a/302/Assets/Prefabs/Anomaly23/ghost.prefab b/302/Assets/Prefabs/Anomaly23/ghost.prefab index f48c7b2..a2156c6 100644 --- a/302/Assets/Prefabs/Anomaly23/ghost.prefab +++ b/302/Assets/Prefabs/Anomaly23/ghost.prefab @@ -777,9 +777,11 @@ MonoBehaviour: speedInit: 1 speedDelta: 5 durationChase: 25 - durationBlow: 5 + durationBlow: 8 timeAudioStart: 3 durationFade: 3 + numRotate: 240 + speedBlow: 20 --- !u!82 &3035267094544484457 AudioSource: m_ObjectHideFlags: 0 diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23Ghost.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23Ghost.cs index 70d533b..5a78cca 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23Ghost.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23Ghost.cs @@ -21,6 +21,8 @@ public class Anomaly23Ghost : AbstractAnomalyObject public float durationBlow; public float timeAudioStart; public float durationFade; + public int numRotate; + public float speedBlow; // 애니메이터 private Animator _animator; @@ -174,12 +176,12 @@ public override bool ResetAnomaly() { bool res = base.ResetAnomaly(); - _audioSource.enabled = false; - Log("Reset audio source success"); - Log("Call `BlowAsync` asynchronously"); StartCoroutine(BlowAsync()); + Log("Call `FadeAudioAsync` asynchronously"); + StartCoroutine(FadeAudioAsync()); + return res; } @@ -216,18 +218,42 @@ private IEnumerator FadeAudioAsync() private IEnumerator BlowAsync() { SCH_Random random = new SCH_Random(); + Vector3 originStart = transform.position; + Vector3 origin; float timeStart = Time.time; - float time; + float time = 0.0f; - yield return new WaitForSeconds(0.1f); - - while ((time = Time.time - timeStart) < durationBlow) { - float scale = (float)(random.LogNormalDist(0.0, 1.0) * 1.5); - - transform.rotation = Random.rotation; - transform.localScale = new Vector3(scale, scale, scale); + yield return null; - yield return new WaitForSeconds(0.1f); + for (int i = 1; i <= numRotate; i++) { + Vector3 position; + Quaternion a; + Quaternion b; + + origin = originStart + Vector3.up * time / durationBlow * 4.0f; + do { + position = new Vector3( + (float)random.NormalDist(), + (float)random.NormalDist(), + (float)random.NormalDist() + ); + position += origin - transform.position; + } while (position.magnitude == 0.0f); + + a = transform.rotation; + b = transform.rotation; + b.SetLookRotation(position, position); + + while ((time = Time.time - timeStart) < durationBlow / numRotate * i) { + float scale = 1.0f - time / durationBlow; + float t = time / durationBlow * numRotate % 1.0f; + + transform.localScale = new Vector3(scale, scale, scale); + transform.rotation = Quaternion.Lerp(a, b, t); + transform.Translate(Vector3.forward * speedBlow * Time.deltaTime); + + yield return null; + } } Destroy(gameObject);