protected override void NewFixedUpdate() { base.NewFixedUpdate(); // Apply damage to player if in time bubbles if (AffectingTimeBubbles.Count > 0) { ApplyDamage(GameSettings.BUBBLE_DAMAGE_PER_SECOND * Mathf.Min(AffectingTimeBubbles.Count, GameSettings.MAX_DAMAGING_BUBBLES) * Time.fixedDeltaTime); } // or heal the player if not in a time bubble else { if (PlayerHealth < maxPlayerHealth) { PlayerHealth += GameSettings.HEALTH_REGEN_PER_SECOND * Time.fixedDeltaTime; if (PlayerHealth > maxPlayerHealth) { PlayerHealth = maxPlayerHealth; } } } // Check to see if the player is dead if (IsDead) { AudioManager.PlayClipByName("PlayerDeath"); Destroy(this.gameObject); } if (IsBeingKnockedBack) { transform.position += knockbackVelocity * LocalFixedDeltaTime; bodyAngle = MathLib.Atand2(transform.right.y, transform.right.x); knockbackTimer -= LocalFixedDeltaTime; } else if (!IsFrozen) { currentSpeed = Mathf.Lerp(currentSpeed, 0, linearDrag * LocalFixedDeltaTime); Thrust(XCI.GetAxis(XboxAxis.RightTrigger, playerNumber) - XCI.GetAxis(XboxAxis.LeftTrigger, playerNumber)); if (Mathf.Abs(XCI.GetAxis(XboxAxis.RightStickX, playerNumber)) > 0.1 || Mathf.Abs(XCI.GetAxis(XboxAxis.RightStickY, playerNumber)) > 0.1) { RotateTurretTo(MathLib.Atand2(XCI.GetAxis(XboxAxis.RightStickY, playerNumber), XCI.GetAxis(XboxAxis.RightStickX, playerNumber))); } bodyAngle -= MaxTurnSpeed * currentSpeed * XCI.GetAxis(XboxAxis.LeftStickX, playerNumber) * LocalFixedDeltaTime; transform.position += new Vector2(MathLib.Cosd(bodyAngle), MathLib.Sind(bodyAngle)).ToVector3() * currentSpeed * LocalFixedDeltaTime; transform.rotation = Quaternion.Euler(0, 0, bodyAngle); transform.GetChild(0).rotation = Quaternion.Euler(0, 0, TurretAngle); } CoolDownA -= LocalFixedDeltaTime; }