コード例 #1
0
    private void Update()
    {
        if (!bDieState && BattleMng.Ins.battleStart)
        {
            if (bRunState)
            {
                anim.SetBool("RnuState", bRunState);

                GetTarget();

                if (target != null)
                {
                    this.transform.LookAt(target.transform.position);

                    float step = fSpeed * Time.deltaTime;

                    bAtkState = ExtensionMethod.Distance(this.transform.position, target.transform.position, nAtkRange);
                }

                if (bAtkState == false)
                {
                    this.transform.position -= Vector3.forward * Time.deltaTime;
                }
            }
        }
        else if (bDieState && BattleMng.Ins.battleStart)
        {
            bAtkState  = false;
            bIdleState = true;
            bRunState  = false;
            anim.SetBool("IdleState", bIdleState);
            anim.SetBool("AtkState", bAtkState);
            anim.SetBool("RnuState", bRunState);
            anim.SetInteger("DieState", -1);

            StartCoroutine(Die());
            return;
        }

        if (bAtkState)
        {
            bRunState = false;
            anim.SetBool("RnuState", bRunState);
            anim.SetBool("AtkState", bAtkState);

            if (currentTime > 0.0f)
            {
                currentTime -= Time.deltaTime;

                if (currentTime < 0.0f)
                {
                    Define.Attack_ToHero(target, BattleMng.Ins.monster);

                    var temp = BattleUIMng.Ins.hitText.GetHitText();

                    BattleUIMng.Ins.hitTextUI.ActionText(target, temp, nAtk);

                    target.hpBar.HpDown(BattleMng.Ins.monster.nAtk);
                    bDamageState = true;

                    currentTime = time;
                }
            }
        }

        if (target != null && target.currentHp <= 0)
        {
            currentTarget.Remove(target);
            target    = null;
            bAtkState = false;
            bRunState = true;
        }
    }