コード例 #1
0
ファイル: Unit.cs プロジェクト: Bass-Players/ImmunityGame
    private IEnumerator BaseBattleAnimations(Base enemy)
    {
        Animating = true;
        GameController.Instance.SetBattleCamera(this.gameObject.transform.position, enemy.gameObject.transform.position);

        float t = 0;

        while (t <= 1.0f)
        {
            t += Time.fixedDeltaTime;
            StartCoroutine(LookAtPosition(this, enemy.transform.position, 0.15f));
            yield return new WaitForEndOfFrame(); // Leave the routine and return here in the next frame
        }

        PlaySound("Attack");

        t = 0;
        Animator animatorA = this.GetComponent<Animator>();
        while (t <= 1.0f)
        {
            t += Time.fixedDeltaTime; // Goes from 0 to 1, incrementing by step each time

            animatorA.Play("Attack");
            animatorA.speed = 2f;

            yield return new WaitForEndOfFrame(); // Leave the routine and return here in the next frame
        }

        enemy.TakeDamage(this.AttackValue);
        enemy.PlaySound("TakeDamage");

        animatorA.Play("Idle");
        GameController.Instance.EnableMainCamera();
        Animating = false;

        EndTurnPanel.Instance.EnableEndTurnButton(true);
    }