public override void OnHit(Attack attack) { if (dead) { return; } if (invincible && !attack.attackerParent.CompareTag(Tags.EnviroDamage)) { return; } if (attack.attackerParent.CompareTag(Tags.EnviroDamage)) { if (envDmgSusceptible) { OnEnviroDamage(); InterruptMeteor(); } else { return; } } CameraShaker.Shake(0.2f, 0.1f); Hitstop.Run(0.1f); InterruptSupercruise(); DamageFor(attack.GetDamage()); GlobalController.FlashWhite(); if (this.currentHP == 0) { return; } InvincibleFor(this.invincibilityLength); CyanSprite(); //compute potential stun StunFor(attack.GetStunLength()); //compute potential knockback //unfreeze if this enemy is in hitstop to preserve the first knockback vector //they'll be put back in hitstop afterwards by the incoming attack if necessary if (inHitstop) { UnLockInSpace(); inHitstop = false; } 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()); } }
public void FlashWhite() { GlobalController.FlashWhite(); }