private bool attemptHurtboxStateChange(SCAttack.HurtboxState newState) { if (newState == this.HurtboxState) return true; updateHurtboxForState(newState); if (this.Hurtbox.CollideFirst(0, 0, this.HaltMovementMask) != null) { // We collided when trying to stand up, so boot out of attack into ducking position _currentAttack = null; updateHurtboxForState(this.HurtboxState); return false; } this.HurtboxState = newState; return true; }
public void LoadCurrentIndex() { if (this.CurrentIndex >= 0 && this.CurrentIndex < this.AttackObject.HitboxKeyframes.Length) { SCAttack.HitboxKeyframe currentHitboxFrame = this.AttackObject.HitboxKeyframes[this.CurrentIndex]; this.Frame = currentHitboxFrame.VisualFrame; for (int i = 0; i < this.Hitboxes.Length; ++i) { if (currentHitboxFrame.HitboxPositions != null && i < currentHitboxFrame.HitboxPositions.Length) { this.Hitboxes[i].enabled = true; this.Hitboxes[i].Offset = IntegerVector.Zero; this.Hitboxes[i].transform.position = (Vector2)currentHitboxFrame.HitboxPositions[i]; this.Hitboxes[i].Size = currentHitboxFrame.HitboxSizes[i]; } else { this.Hitboxes[i].enabled = false; } } this.HurtboxState = currentHitboxFrame.HurtboxState; } this.Animator.GoToFrame(this.Frame); }