Ejemplo n.º 1
0
 public void DestroyBarHP()
 {
     if (enemyHP != null)
     {
         if (!isLastBoss)
         {
             Destroy(enemyHP.gameObject);
         }
         else
         {
             Destroy(enemyHP.gameObject.transform.parent.gameObject);
         }
         Minimap.DestroyEnemy(transform);
         RecoverEnemyHP();
         Theme.ChangeBGM(BGM.Field);
     }
 }
Ejemplo n.º 2
0
        public void TakeDamageFromAttacker(float damagePoint)
        {
            if (isDeath || isTakingDamageBIG || isBlockImpactAIR)
            {
                return;
            }
            Damage.InstantiateDamage(damagePoint, transform.position + Vector3.up);
            if (isLastBoss)
            {
                (brain as AI_LastBoss).TakeDamageFromPlayer();
            }

            isUsingSpecialAttack = false;
            isAttacking          = false;
            animator.Play("ATTACKSTOP");

            damageThreshold += damagePoint;
            bool reCheck = false;

DestinationFromBlockToDirectDamage_BecausePlayerAttackedFromBehindOrSide:

            if (isBlocking && !reCheck)
            {
                if (Mathf.Abs(GM.GetAngleBetweenMeAndPlayer(transform)) > 105)
                {
                    reCheck = true;
                    goto DestinationFromBlockToDirectDamage_BecausePlayerAttackedFromBehindOrSide;
                }

                Tamana.FlameSword.InstantiateParrySE();
                SwordParryEffect.InstantiateEffect(aiAttack.attackCollider);

                var blockThreshold = damageThreshold - (baseStatus.HP * 0.35f);
                if (blockThreshold > 0)
                {
                    currentStatus.HP -= blockThreshold;
                }

                if (currentStatus.HP <= 0)
                {
                    currentStatus.HP     = 0;
                    delayBeforeDestroyUI = 2.0f;
                    playerTransform      = null;
                    isDeath = true;
                    Minimap.DestroyEnemy(transform);

                    if (damageThreshold > baseStatus.HP * .5f)
                    {
                        aiDeath.PlayDeathAir();
                    }
                    else
                    {
                        aiDeath.PlayDeath();
                    }

                    goto Apply;
                }

                if (brain is AI_Strong)
                {
                    if ((brain as AI_Strong).isParryAndCounter)
                    {
                        if (damageThreshold < baseStatus.HP * 0.3f)
                        {
                            var aiStrong = (brain as AI_Strong);
                            aiStrong.PlayParryAndCounter(aiStrong.parryAndCounterEnter, aiStrong.parryAndCounterExit);
                            damageThreshold = 0;
                            return;
                        }
                    }
                }

                if (damageThreshold > baseStatus.HP * 0.3f)
                {
                    aiBlock.PlayBlockImpactAIR();
                }
                else if (damageThreshold > baseStatus.HP * 0.1f)
                {
                    aiBlock.PlayBlockImpactBIG();
                }
                else
                {
                    aiBlock.PlayBlockImpact();
                }
            }
            else // こいつをブロックしなければー
            {
                currentStatus.HP -= damagePoint;

                if (currentStatus.HP <= 0)
                {
                    currentStatus.HP     = 0;
                    delayBeforeDestroyUI = 2.0f;
                    playerTransform      = null;
                    isDeath = true;
                    Minimap.DestroyEnemy(transform);

                    if (damageThreshold > baseStatus.HP * .5f)
                    {
                        aiDeath.PlayDeathAir();
                    }
                    else
                    {
                        aiDeath.PlayDeath();
                    }
                }
                else
                {
                    if (isLastBoss && (brain as AI_LastBoss).isTakingBigDamage)
                    {
                    }
                    else
                    {
                        if (damageThreshold > baseStatus.HP * .5f)
                        {
                            isTakingDamageBIG = true;
                            isBlocking        = false;
                            HitAnimation.mInstance.PlayAir(animator, ref currentHitAnimationName, takingHitComparator);
                        }
                        else if (damageThreshold > baseStatus.HP * .3f)
                        {
                            isTakingDamage = true;
                            HitAnimation.mInstance.PlayHeavy(animator, ref currentHitAnimationName, takingHitComparator);
                        }
                        else
                        {
                            isTakingDamage = true;
                            HitAnimation.mInstance.PlayLight(animator, ref currentHitAnimationName, takingHitComparator);
                        }
                    }
                }
            }

Apply:

            if (isAttacking)
            {
                isAttacking = false;
            }
            animator.SetLayerWeight(animator.GetLayerIndex("Attack"), 0.0f);

            enemyHP_Delay.fillAmount = currentStatus.HP / baseStatus.HP;

            delayHP    = 1.5f;
            updatingHP = true;
        }