コード例 #1
0
    public override void OnHit(Attack attack)
    {
        if (dead)
        {
            return;
        }

        if (!canParry && invincible && !attack.attackerParent.CompareTag(Tags.EnviroDamage))
        {
            return;
        }

        if (attack.attackerParent.CompareTag(Tags.EnviroDamage))
        {
            if (envDmgSusceptible)
            {
                OnEnviroDamage(attack.GetComponent <EnviroDamage>());
                InterruptMeteor();
                if (LayerMask.LayerToName(attack.attackerParent.gameObject.layer) == Layers.Water)
                {
                    ResetAirJumps();
                }
            }
        }
        else if (canParry)
        {
            Parry();
            return;
        }

        CameraShaker.Shake(0.2f, 0.1f);
        StartCombatStanceCooldown();
        Hitstop.Run(selfDamageHitstop);
        InterruptSupercruise();
        DamageFor(attack.GetDamage());
        if (currentHP > 0)
        {
            AlerterText.Alert($"WAVEFORM INTEGRITY {currentHP}");
        }
        if (this.currentHP == 0)
        {
            return;
        }
        else if (currentHP == 1)
        {
            AlerterText.Alert("WAVEFORM CRITICAL");
        }
        InvincibleFor(this.invincibilityLength);
        envDmgSusceptible = true;
        StunFor(attack.GetStunLength());
        if (attack.knockBack)
        {
            //knockback based on the position of the attack
            Vector2 kv             = attack.GetKnockback();
            bool    attackerToLeft = attack.transform.position.x < this.transform.position.x;
            kv.x *= attackerToLeft ? 1 : -1;
            KnockBack(kv);
        }
        if (cyan)
        {
            cyan = false;
            StartCoroutine(NormalSprite());
        }
        anim.SetTrigger("Hurt");
    }
コード例 #2
0
 public void RunHitstop(float duration)
 {
     Hitstop.Run(duration);
 }