public override void Update(float dt) { float footstepsPhase = m_footstepsPhase; float num = m_componentCreature.ComponentLocomotion.SlipSpeed ?? Vector3.Dot(m_componentCreature.ComponentBody.Velocity, m_componentCreature.ComponentBody.Matrix.Forward); if (m_canCanter && num > 0.7f * m_componentCreature.ComponentLocomotion.WalkSpeed) { m_gait = Gait.Canter; base.MovementAnimationPhase += num * dt * 0.7f * m_walkAnimationSpeed; m_footstepsPhase += 0.7f * m_walkAnimationSpeed * num * dt; } else if (m_canTrot && num > 0.5f * m_componentCreature.ComponentLocomotion.WalkSpeed) { m_gait = Gait.Trot; base.MovementAnimationPhase += num * dt * m_walkAnimationSpeed; m_footstepsPhase += 1.25f * m_walkAnimationSpeed * num * dt; } else if (MathUtils.Abs(num) > 0.2f) { m_gait = Gait.Walk; base.MovementAnimationPhase += num * dt * m_walkAnimationSpeed; m_footstepsPhase += 1.25f * m_walkAnimationSpeed * num * dt; } else { m_gait = Gait.Walk; base.MovementAnimationPhase = 0f; m_footstepsPhase = 0f; } float num2 = 0f; if (m_gait == Gait.Canter) { num2 = (0f - m_walkBobHeight) * 1.5f * MathUtils.Sin((float)Math.PI * 2f * base.MovementAnimationPhase); } else if (m_gait == Gait.Trot) { num2 = m_walkBobHeight * 1.5f * MathUtils.Sqr(MathUtils.Sin((float)Math.PI * 2f * base.MovementAnimationPhase)); } else if (m_gait == Gait.Walk) { num2 = (0f - m_walkBobHeight) * MathUtils.Sqr(MathUtils.Sin((float)Math.PI * 2f * base.MovementAnimationPhase)); } float num3 = MathUtils.Min(12f * m_subsystemTime.GameTimeDelta, 1f); base.Bob += num3 * (num2 - base.Bob); if (m_gait == Gait.Canter && m_useCanterSound) { float num4 = MathUtils.Floor(m_footstepsPhase); if (m_footstepsPhase > num4 && footstepsPhase <= num4) { string footstepSoundMaterialName = m_subsystemSoundMaterials.GetFootstepSoundMaterialName(m_componentCreature); if (!string.IsNullOrEmpty(footstepSoundMaterialName) && footstepSoundMaterialName != "Water") { m_subsystemAudio.PlayRandomSound("Audio/Footsteps/CanterDirt", 0.75f, m_random.Float(-0.25f, 0f), m_componentCreature.ComponentBody.Position, 3f, autoDelay: true); } } } else { float num5 = MathUtils.Floor(m_footstepsPhase); if (m_footstepsPhase > num5 && footstepsPhase <= num5) { m_componentCreature.ComponentCreatureSounds.PlayFootstepSound(1f); } } if (base.FeedOrder) { m_feedFactor = MathUtils.Min(m_feedFactor + 2f * dt, 1f); } else { m_feedFactor = MathUtils.Max(m_feedFactor - 2f * dt, 0f); } base.IsAttackHitMoment = false; if (base.AttackOrder) { m_buttFactor = MathUtils.Min(m_buttFactor + 4f * dt, 1f); float buttPhase = m_buttPhase; m_buttPhase = MathUtils.Remainder(m_buttPhase + dt * 2f, 1f); if (buttPhase < 0.5f && m_buttPhase >= 0.5f) { base.IsAttackHitMoment = true; } } else { m_buttFactor = MathUtils.Max(m_buttFactor - 4f * dt, 0f); if (m_buttPhase != 0f) { if (m_buttPhase > 0.5f) { m_buttPhase = MathUtils.Remainder(MathUtils.Min(m_buttPhase + dt * 2f, 1f), 1f); } else if (m_buttPhase > 0f) { m_buttPhase = MathUtils.Max(m_buttPhase - dt * 2f, 0f); } } } base.FeedOrder = false; base.AttackOrder = false; base.Update(dt); }