예제 #1
0
        private IEnumerator PoisonAnim(EnemyAction randomAction)
        {
            var waitFrame = new WaitForEndOfFrame();
            var timer     = 0f;

            var startPos = transform.position;
            var endPos   = LevelManager.instance.playerController.transform.position;

            var startRot = transform.localRotation;
            var endRot   = Quaternion.Euler(60, 0, 60);

            while (true)
            {
                timer += Time.deltaTime * 5;

                transform.position      = Vector3.Lerp(startPos, endPos, timer);
                transform.localRotation = Quaternion.Lerp(startRot, endRot, timer);
                if (timer >= 1f)
                {
                    break;
                }

                yield return(waitFrame);
            }

            timer = 0f;
            AudioManager.instance.PlayOneShot(randomAction.mySoundProfile.GetRandomClip());
            LevelManager.instance.playerController.myHealth.ApplyPoisonDamage(randomAction.value);
            yield return(new WaitForEndOfFrame());

            while (true)
            {
                timer += Time.deltaTime * 5;

                transform.position      = Vector3.Lerp(endPos, startPos, timer);
                transform.localRotation = Quaternion.Lerp(endRot, startRot, timer);
                if (timer >= 1f)
                {
                    break;
                }

                yield return(waitFrame);
            }
        }
예제 #2
0
        private IEnumerator SpaceAnim(EnemyAction randomAction)
        {
            var waitFrame = new WaitForEndOfFrame();
            var timer     = 0f;

            var startPos = transform.position;
            var endPos   = startPos + new Vector3(0, 2, 0);

            while (true)
            {
                timer += Time.deltaTime * 2;

                transform.position = Vector3.Lerp(startPos, endPos, timer);

                if (timer >= 1f)
                {
                    break;
                }

                yield return(waitFrame);
            }
            AudioManager.instance.PlayOneShot(randomAction.mySoundProfile.GetRandomClip());
            LevelManager.instance.ExhaustRandomCard();
            timer = 0f;
            while (true)
            {
                timer += Time.deltaTime * 2;

                transform.position = Vector3.Lerp(endPos, startPos, timer);

                if (timer >= 1f)
                {
                    break;
                }

                yield return(waitFrame);
            }
        }
예제 #3
0
 public void ShowNextAction()
 {
     _nextAction        = myActions[Random.Range(0, myActions.Count)];
     actionImage.sprite = _nextAction.actionSprite;
 }