BroBase - alexneargarder/Broforce-Docs GitHub Wiki
BroBase
Table of Contents
- Unity Lifecycle & Setup
- Combat & Damage
- Methods
- AnimateCustomMelee
- AnimateKnifeMelee
- AnimateMelee
- AnimateMeleeCommon
- AnimatePunch
- CancelMelee
- CanStartMeleeFollowUp
- CanStartNewMelee
- CanStartNewPunch
- KickDoors
- PerformKnifeMeleeAttack
- PerformOverriddenMelee
- PerformPunchAttack
- PerformSmashAttack
- ResetMeleeValues
- RunCustomMeleeMovement
- RunJetPackPunchMovement
- RunMelee
- RunPunchMovement
- StartCustomMelee
- StartKnifeMelee
- StartMelee
- StartMeleeCommon
- StartPunch
- TryMeleeTerrain
- Fields
- Methods
- Special Abilities
- Methods
- AnimatePockettedSpecial
- GetPockettedAmmoType
- GetSprintValue
- MustUsePockettedSpecialAmmo
- PickupPockettableAmmo
- ReducePockettedSpecialAmmo
- ReleaseRemoteControlCar
- SetPlayerHUDAmmo
- StartPockettedSpecial
- ThrowAirstrikeGrenade
- ThrowAlienPheromoneGrenade
- ThrowMechDropGrenade
- TimeSlowSpecialRPC
- UsePockettedSpecial
- UseSteroids
- UseSteroidsForDuration
- UseSteroidsNetworked
- UseSteroidsNetworkedForDuration
- Properties
- Fields
- Methods
- Position & Physics
- Character State & Effects
- Animation & Sprite Systems
- Input & Control
- Audio System
- Environmental Interaction
- Helper & Utility
Unity Lifecycle & Setup
Methods
protected override void Awake()
Initializes the BroBase instance, marking it as a hero character and adding it to the static bros list. Sets up essential hero-specific functionality before other components initialize.
protected override void OnDestroy()
Cleans up the BroBase instance by removing it from the static bros list before destruction. Ensures proper cleanup of static references to prevent memory leaks.
protected override void Start()
Completes BroBase initialization after all objects are created. Sets up network syncing and jetpack state.
protected override void Update()
Processes BroBase-specific updates each frame including flex invulnerability, network synchronization, performance enhancement effects, cardio/dashing mechanics, jetpack functionality, and holy water revival timing. Extends base update functionality with hero-specific behaviors.
Combat & Damage
Methods
protected virtual void AnimateCustomMelee()
Handles animation for custom melee types. Default implementation delegates to knife melee animation, serving as override point for unique attack animations in derived bros.
protected virtual void AnimateKnifeMelee()
Animates knife attacks with context-specific sprite sequences. Uses row 1 (frames 25-31) for standing attacks and row 6 (frames 17-23) for jumping/dashing variants. Triggers attack on frame 3 with extended timing for dashing strikes.
protected override void AnimateMelee()
Routes melee animation to type-specific methods. Directs knife attacks to knife animation, punches to punch animation, and all other types to custom melee animation. Central routing point for the 15 different melee attack types.
protected void AnimateMeleeCommon()
Provides shared animation logic for melee attacks. Handles sprite resets, frame timing (40 FPS), melee follow-up loops, and high-five interrupts for throwing nearby mooks during melee combos.
protected virtual void AnimatePunch()
Animates punch attacks using sprite frames 25-33. Triggers punch attacks on frame 3, with extended attack window for jetpack punches (frames 4-5). Includes impact emphasis delays and combo loop support.
protected override void CancelMelee()
Cancels ongoing melee attacks and resets related state. Clears the chosen melee target, restores normal fall speed, and resets direction change cancellation flag. Ensures clean exit from melee state.
protected virtual bool CanStartMeleeFollowUp()
Determines if a follow-up melee attack can begin during current animation. Returns true after frame 7, enabling combo chains and continuous melee sequences.
Returns:
bool
: True if current animation frame is greater than 7; otherwise, false.
protected virtual bool CanStartNewMelee()
Checks if a new melee attack can interrupt the current action. Allows new attacks when not meleeing or after frame 3 of current melee, enabling responsive combat and combo potential.
Returns:
bool
: True if not meleeing or frame is greater than 3; otherwise, false.
protected virtual bool CanStartNewPunch()
Validates timing for new punch attacks with slightly stricter requirements than general melee. Allows punches when not meleeing or after frame 4, providing balanced combo timing.
Returns:
bool
: True if not meleeing or frame is greater than 4; otherwise, false.
protected void KickDoors(float range)
Kicks doors and destructible objects within specified range. Performs raycast detection, excludes parachutes, sends open command with direction, and applies 500 horizontal crush force to break barriers.
Parameters:
- float range: Maximum distance to check for kickable objects.
protected virtual void PerformKnifeMeleeAttack(bool shouldTryHitTerrain, bool playMissSound)
Executes knife slash attacks with 14x24 unit hit box. Deals knife damage type, kicks doors within 24 units, applies 200 horizontal and 500 vertical knockback force. Creates appropriate hit effects and sounds.
Parameters:
- bool shouldTryHitTerrain: Whether to attempt terrain damage if no unit is hit.
- bool playMissSound: Whether to play miss sound if attack fails to connect.
protected virtual void PerformOverriddenMelee()
Virtual hook for derived classes to implement custom melee attacks. Empty base implementation allows subclasses to define unique melee behaviors without modifying core melee system.
protected virtual void PerformPunchAttack(bool shouldTryHitTerrain, bool playMissSound)
Executes punch attacks with standard or jetpack-enhanced variants. Standard punches deal 4 damage with 250 knockback force, while jetpack punches deal 10 damage with 600 knockback force. Creates visual effects, kicks doors, damages terrain, and adds upward momentum for jetpack variant.
Parameters:
- bool shouldTryHitTerrain: Whether to attempt terrain damage if no unit is hit.
- bool playMissSound: Whether to play miss sound if attack fails to connect.
protected virtual void PerformSmashAttack()
Performs crushing smash attacks with 8 unit range. Deals 10 crush damage with minimal horizontal knockback (20 force) but moderate vertical force (50). Uses alternate sound effects to differentiate from standard attacks.
protected virtual void ResetMeleeValues()
Resets melee state flags to prepare for new attacks. Clears miss sound, attack performed, and hit flags. Virtual method allowing subclasses to reset additional melee-related state.
protected virtual void RunCustomMeleeMovement()
Controls movement during custom melee attacks. Default implementation uses knife melee movement pattern, providing override point for specialized movement behaviors.
protected virtual void RunJetPackPunchMovement()
Manages special movement for jetpack-powered punches. Creates horizontal jetpack flames and applies 200 unit thrust force during frames 2-4, followed by rapid deceleration. Provides unique physics for aerial combat moves.
protected override void RunMelee()
Manages movement during melee attacks based on type. Routes knife attacks to knife movement, punches to punch movement, jetpack punches to special jetpack movement, and others to custom movement handlers.
protected virtual void RunPunchMovement()
Controls movement during punch attacks. Applies gravity for aerial punches, enables dash movement toward targets on frames 2-4 (up to 1.7x speed), and stops movement during recovery frames. Cancels if falling below ground.
protected virtual void StartCustomMelee()
Initiates custom melee attacks with combo support. Validates attack timing, enables dashing melee mode when grounded, applies movement velocity, and handles melee follow-up chains. Entry point for non-standard melee types.
protected virtual void StartKnifeMelee()
Initiates knife melee attacks with timing validation. Resets interaction timers, deactivates weapons, handles combo chains through melee follow-up system, and applies movement for dashing variants.
protected override void StartMelee()
Initializes melee attacks with type-specific routing. Detects special conditions like standing on animals (forces knife melee) and routes to appropriate start methods: knife, punch, or custom melee based on the current melee type.
protected virtual void StartMeleeCommon()
Common initialization for all melee attack types. Validates melee can start, resets state flags, deactivates weapons, records starting position, and triggers initial animation. Core setup for the melee system.
protected virtual void StartPunch()
Initializes punch attacks with combo support. Validates punch can start, handles melee follow-up for combo chains, and delegates to common melee initialization. Entry point for standard and combo punches.
protected virtual bool TryMeleeTerrain(int offset = 0, int meleeDamage = 2)
Attempts to damage terrain or destructible objects with melee attacks. Performs raycast detection in melee range, deals configurable damage, and creates appropriate hit effects. Special handling for cage objects using full health as damage.
Parameters:
- int offset: Horizontal offset for the terrain check.
- int meleeDamage: Amount of damage to deal to terrain (default 2).
Returns:
bool
: True if terrain was hit and damaged; otherwise, false.
Fields
protected BroBase.MeleeType currentMeleeType
Active melee type being performed. Can differ from default when context changes (animal attacks force knife). Controls animation and damage calculations. Dynamic combat state.
public SpriteSM disembowelmentViscera
Sprite template for gore effects during disembowel attacks. Instantiated and positioned at enemy location when disembowel melee succeeds. Creates visceral feedback for brutal melee finishers.
protected bool hasJumpedForKick
Tracks if automatic jump has occurred during kick animation. Prevents multiple jumps per kick. At frame 2, adds 150 upward velocity if false and grounded. Ensures consistent kick height.
protected float lerpToMeleeTargetPos
Interpolation value for smooth melee movement toward target. Reset at melee start. Enables fluid combat positioning. Animation smoothing parameter.
protected Vector3 meleeStartPos = Vector3.zero
Starting position vector when melee attack initiated. Captured in StartCustomMelee. Used for return positioning and movement calculations. Combat positioning anchor.
public BroBase.MeleeType meleeType
Default melee attack type for this bro character. Source value for currentMeleeType. Defines base combat style (knife, punch, etc). Character-specific combat identifier.
protected bool performedMeleeAttack
Tracks if damage has been dealt in current melee attack. Reset in ResetMeleeValues. Prevents multiple damage applications per swing. Hit validation flag.
protected bool splitkick
Flag for split kick attack hitting both directions simultaneously. Set when horizontal velocity is low during kick initiation. Enables martial arts characters to hit enemies on both sides.
Special Abilities
Methods
protected override void AnimatePockettedSpecial()
Animates pocketed special abilities with type-specific handling. Airstrike, MechDrop, and AlienPheromones use custom animation (row 5, frames 17-24) with ability trigger at frame 4. Other types use standard special animation.
protected PockettedSpecialAmmoType GetPockettedAmmoType()
Retrieves the current pocketed ammunition type to use. Returns the top item from the stack or None if inventory is empty, determining which special ability executes on use.
Returns:
PockettedSpecialAmmoType
: The next pocketed ammo type to use, or None if empty.
protected override bool GetSprintValue()
Determines if the bro can currently sprint. Prevents sprinting while exhausted from overexertion, otherwise delegates to base sprint logic.
Returns:
bool
: False if exhausted; otherwise, returns base sprint value.
protected override bool MustUsePockettedSpecialAmmo()
Determines if pocketed ammunition must be used before default specials. Forces players to consume pickups before accessing their character's built-in abilities, ensuring pickup utility.
Returns:
bool
: True if any pocketed ammo exists; otherwise, false.
public override void PickupPockettableAmmo(PockettedSpecialAmmoType ammoType)
Adds pocketed special ammunition to inventory stack. Validates ammo type, appends to end of list for LIFO usage order, and updates HUD to display the newly acquired special ability.
Parameters:
- PockettedSpecialAmmoType ammoType: The type of special ammunition being picked up.
protected void ReducePockettedSpecialAmmo()
Removes used pocketed ammunition from inventory stack. Removes from end of list maintaining LIFO order and updates HUD to reflect remaining ammunition or return to default special display.
public void ReleaseRemoteControlCar()
Deploys remote-controlled vehicle from inventory. Simple wrapper that delegates to base implementation for RC car spawning and control transfer mechanics.
private void SetPlayerHUDAmmo()
Updates HUD special ability display based on current inventory. Shows top pocketed ammo type with count of 1 if any exist, otherwise displays hero's default special ability with actual ammo count.
protected override void StartPockettedSpecial()
Initiates use of pocketed special ammunition pickups. Validates bro state (not acid-covered or meleeing), sets the active special type, flags special use, and resets animation for special ability execution.
public void ThrowAirstrikeGrenade()
Deploys airstrike grenade with stance-based trajectory. Crouching throws short (30 velocity, 70 angle) for close targets, standing throws long (200 velocity, 150 angle) for distant targets. Network-spawned projectile calls in aerial bombardment on impact.
public void ThrowAlienPheromoneGrenade()
Deploys alien pheromone grenade for biological warfare. Uses standard stance-based throwing mechanics to deliver pheromones that affect alien behavior. Network-spawned projectile with tactical deployment options.
public void ThrowMechDropGrenade()
Deploys mech drop grenade with identical mechanics to airstrike. Uses stance-based throwing system to mark landing zone for mech deployment. Network-synchronized projectile spawns combat mech on detonation.
public void TimeSlowSpecialRPC()
Executes time-slowing special ability with mode-specific targeting. Plays bass drop sound, applies 1.2x general time boost, and adds color shift effect. In cooperative modes boosts all heroes by 1.5x, in competitive modes only boosts the casting player.
protected override void UsePockettedSpecial()
Executes pocketed special abilities via type-specific RPC calls. Handles Airstrike, Timeslow, RemoteControlCar, MechDrop, AlienPheromones, and Steroids. Manages ammo consumption, HUD updates, and network synchronization for each ability type.
public virtual void UseSteroids()
Activates 10-second performance enhancement state. Sets enhanced flag, plays flex sound at 0.6 volume, triggers flex gesture animation, and initializes grunt counter based on player number for audio variety.
public virtual void UseSteroidsForDuration(float duration)
Activates performance enhancement for specified duration. Identical to standard steroids but with customizable timing, maintaining all visual and audio feedback effects.
Parameters:
- float duration: Duration in seconds for the steroid effect.
public override void UseSteroidsNetworked()
Network wrapper for steroid activation across all players. Validates local ownership before broadcasting RPC to trigger steroid effects on all connected clients, ensuring synchronized performance enhancement.
public override void UseSteroidsNetworkedForDuration(float duration)
Network wrapper for variable-duration steroid activation. Broadcasts typed RPC with custom duration parameter to apply performance enhancement across all players with specified timing.
Parameters:
- float duration: Duration in seconds for the steroid effect.
Properties
public override int SpecialAmmo { get; set; }
Gets or sets the special ammo count with support for pocketed special ammo. When getting, returns 1 if the bro has pocketed special ammo stored, otherwise returns the actual special ammo count.
Returns:
int
: 1 if has pocketed special ammo; otherwise, the base special ammo count.
Fields
public List<PockettedSpecialAmmoType> pockettedSpecialAmmo = new List<PockettedSpecialAmmoType>()
Stack of special ammunition types collected from crates but not yet used. Functions as LIFO (last-in-first-out) where newest ammo is used first. When non-empty, overrides standard special ammo and displays custom HUD icons. Consumed via ReducePockettedSpecialAmmo when special is triggered.
protected PockettedSpecialAmmoType usingPockettedSpecialType = PockettedSpecialAmmoType.Standard
Currently active pocketed special ammo type. Set during special ability use from inventory. Determines animation behavior for Airstrike, MechDrop, AlienPheromones. Default is Standard type.
Position & Physics
Methods
protected override void AddSpeedLeft()
Applies leftward movement with performance boost. When enhanced and not in quicksand, increases left movement to 120% speed (maintains dash multiplier if dashing). Base movement applied first.
protected override void AddSpeedRight()
Applies rightward movement with performance boost. When enhanced and not in quicksand, increases right movement to 120% speed (maintains dash multiplier if dashing). Mirrors left movement logic.
protected override void AirJump()
Executes air jump with fart-based mechanics. Level 1 creates smoke and sound effects. Level 2 creates damaging explosion with huge fart sound. Jump force scales 0.5x-1.8x based on velocity, halves downward momentum before boost.
protected override bool CanUseJetpack()
Validates jetpack availability for use. Requires both local jetpack availability flag and player having Jetpack value in ValueOrchestrator system.
Returns:
bool
: True if jetpack is available and player has jetpack power-up; otherwise, false.
protected virtual void CreateBlastOffFlames(float yPos)
Creates flame explosion effect at specified height. Spawns visual flame wall, damages units in 14x10 area with fire damage, applies 50 upward force. Only executes for local player ownership.
Parameters:
- float yPos: Vertical position for flame effect spawn.
protected virtual void Fart(int fartLevel)
Virtual method for fart effects implementation. Empty base implementation provides hook for derived classes to implement custom fart behaviors based on fart level.
Parameters:
- int fartLevel: Intensity level of the fart effect.
protected override void HitLeftWall()
Handles left wall collisions with melee cancellation. Extends base wall hit behavior by canceling ongoing melee attacks if a target has already been hit, preventing attacks from continuing through walls.
protected override void HitRightWall()
Handles right wall collisions with melee cancellation. Extends base wall hit behavior by canceling ongoing melee attacks if a target has already been hit, preventing attacks from continuing through walls.
protected override void Jump(bool wallJump)
Initiates jump with air ability resets. Enables flex air jumps and fart jumps based on available powers. Resets elbow slam and somersault states for clean jump execution.
Parameters:
- bool wallJump: Whether this is a wall jump.
protected override void Land()
Handles landing mechanics with special elbow slam effects. Elbow slam creates shockwave explosion, damages units in 22x8 area and ground in 24 radius. Normal landing resets air abilities and jetpack availability.
protected override void StartDashing()
Initiates dashing with special "fart dash" enhancement. When specific conditions are met, creates smoke effects, disturbs wildlife within 100 units, plays fart sound, and adds 50 horizontal and 60 vertical velocity boost.
private void StopElbowSlamming()
Cancels elbow slam state and restores abilities. Resets slam flag and re-enables wall climbing capability. Simple state cleanup for movement system.
protected override void UseJetpack()
Activates jetpack thrust with context-sensitive boost. Near ground (within 20 units) creates blast-off flames and strong upward boost (140+ velocity). In air provides moderate boost (60 velocity) with -50 floor. Manages jetpack state and audio.
Properties
protected override float GetSpeed { get; set; }
Gets movement speed with exhaustion penalty. Returns 75% speed when exhausted, normal speed when performance enhanced (negating exhaustion), or base speed otherwise.
Returns:
float
: Current movement speed multiplier.
public override float jumpForce { get; set; }
Gets or sets jump force with dynamic modifiers. Applies ValueOrchestrator modifications when player exists, adds 10% boost when performance enhanced. Setter stores base value for modification calculations.
Returns:
float
: Modified jump force value based on power-ups and performance state.
Fields
private float cardioTime
Current sprint duration counter in seconds. Increments while dashing, decreases when not. Clamped 0-3 seconds. Triggers exhaustion when exceeding player's modified sprint time limit.
private float fartingCounter
Timer for periodic fart explosions during flatulence. Resets every 0.07 seconds, triggering tiny explosions, ground damage, and velocity changes. Creates continuous area denial effect.
private float fartingTime
Active duration of flatulence explosion effect. Set to 0.3 for delayed fart, 0.36 for huge fart. While active, creates periodic explosions via fartingCounter. Comedy mechanic with gameplay impact.
private int fartJumpsLeftCount
Counter for remaining flatulence-based air jumps. Reset to 1 when grounded or acquiring flatulence power. Decremented on use. Enables comedic double-jump mechanic with explosive effects.
private int flexAirJumpsLeft
Counter for remaining flex-powered air jumps. Set to 1 when landing or acquiring FlexAirJump perk. Consumed during air flex abilities. Enables acrobatic aerial maneuvers.
protected bool frontSomersaulting
Active state flag for front flip animation sequence. Set after air flex completion or specific actions. Enables chaining into elbow slam. Visual flourish for acrobatic moves.
private float lastAirFlexJumpTime
Timestamp of last air flex jump for cooldown enforcement. Prevents air flex spam with 0.1 second minimum interval. Ensures balanced aerial movement.
private float lastTeleportFlexJumpTime
Timestamp of last teleport flex use for 0.2 second cooldown. Prevents teleport ability spam. Works with FlexTeleport perk for tactical repositioning.
private float maxCardioDuration = 2.5f
Base maximum sprint duration before exhaustion triggers. Default 2.5 seconds, modified by ValueOrchestrator. Compared against cardioTime to determine when stamina depletes.
Character State & Effects
Methods
protected override void AlertNearbyMooks()
Alerts nearby enemies with special pickpocket mechanic when dashing. If player has PickPocketMoney value, finds unalerted mooks within 8x8 range, fully alerts them, and triggers pickpocket perk event. Always alerts mooks normally afterward.
protected virtual void ApplyPerformanceEnhancedFlexing()
Applies flexing animation when the bro is performance enhanced and idle. Virtual method allowing derived bros to customize their flexing behavior.
protected virtual void BecomeExhausted()
Makes the bro exhausted from overexertion, preventing sprinting for 2.3 seconds. Stops any current dashing and resets cardio timer. Virtual method for subclass customization.
public override void BurstChest()
Handles chest burst effect with flex invulnerability protection. Only processes chest burst if not protected by flex invulnerability, preventing alien chest bursts during temporary invulnerability periods.
public override bool CanFreeze()
Determines if this bro can be affected by freeze effects. Always returns true for BroBase characters, maintaining the base class behavior that heroes can be frozen.
Returns:
bool
: Always returns true.
protected override bool CanReduceLives()
Determines if death should consume a life. Returns false if marked for revival (preventing life loss), otherwise uses base logic. Critical for revival mechanics where death is temporary.
Returns:
bool
: False if will revive; otherwise, base implementation result.
public override void Damage(int damage, DamageType damageType, float xI, float yI, int direction, MonoBehaviour damageSender, float hitX, float hitY)
Processes incoming damage with revival and flex invulnerability checks. If marked for revival and damaged within 5 seconds of death, accelerates revival to 0.6 seconds. Ignores all damage during flex invulnerability. Always cancels elbow slam state when damaged.
Parameters:
- int damage: Amount of damage to apply.
- DamageType damageType: Type of damage being inflicted.
- float xI: Horizontal knockback force.
- float yI: Vertical knockback force.
- int direction: Direction of the damage source.
- MonoBehaviour damageSender: The object that caused the damage.
- float hitX: X coordinate of the hit location.
- float hitY: Y coordinate of the hit location.
public override void Death(float xI, float yI, DamageObject damage)
Handles character death with special effect cleanup. Sets posthumous fart delay (0.9s) for max flatulence level if not reviving. Destroys active flex effect GameObject. Delegates core death logic to base implementation.
Parameters:
- float xI: Horizontal death force/velocity.
- float yI: Vertical death force/velocity.
- DamageObject damage: The damage object that caused death.
public override void DelayedRevive(float delay)
Configures delayed revival after death. Sets revival timer, prevents gibbing during revival window, marks for revival, and resets kill reporting. Integrates with holy water revival system for death recovery.
Parameters:
- float delay: Time in seconds before revival occurs.
protected void HolyWaterRevive()
Revives a dead bro using holy water mechanics. Restores the bro to life with 1 health, applies temporary invulnerability, launches them upward, triggers time slowdown effects, and creates visual indicators.
protected void HolyWaterReviveRPC()
Network RPC handler for holy water revival. Processes revival commands from other players in multiplayer, only executing if the bro is currently dead.
public override bool IsAlive()
Checks character alive status including revival state. Returns true if marked for revival with time remaining OR base alive check passes. Allows systems to treat reviving characters as semi-alive.
Returns:
bool
: True if reviving or health greater than 0; otherwise, false.
protected virtual void PerformanceEnhancedGrunt()
Creates area effects when grunting while performance enhanced. Every 4th grunt panics nearby units within 64 units, and in competitive modes also stuns them. Virtual method allowing subclass customization.
protected override void SetActionstateToIdle()
Transitions the character to idle state with special handling for performance enhancement mode. Resets animation frame to 0 when performance enhanced and not performing other actions.
public override void SetGestureAnimation(GestureElement.Gestures gesture)
Complex gesture handler managing elbow slam, air flex, teleport flex, and visual effects. Triggers elbow slam when somersaulting+flex+down in air. Manages air flex with multiple validation checks. Creates flex visual effects and handles teleport initiation with time gates.
Parameters:
- Gestures gesture: The gesture type to animate.
protected override void TriggerFlexEvent()
Executes flex power effects based on player abilities. FlexAlluring attracts mooks within 96 units. FlexGoldenLight spawns 8-12 projectiles in arc pattern. FlexInvulnerability plays sound effect. Manages audio feedback for all flex powers.
Properties
public override bool IsPerformanceEnhanced { get; set; }
Gets whether the character is currently performance enhanced from steroids. Returns the value of the performanceEnhanced field which is set when using steroids for temporary ability boosts.
Returns:
bool
: True if performance enhanced; otherwise, false.
public override bool WillReviveAlready { get; set; }
Gets whether this bro will automatically revive after death. Set to true when holy water revival is triggered, checked during update to perform the actual revival.
Returns:
bool
: True if the bro has a pending revival; otherwise, false.
Fields
protected float cannotGibTime
Temporary gibbing immunity duration to preserve body during revival. Set during DelayedRevive to prevent destruction. Ensures revival animations can play properly without body disappearing.
private float exhaustedTime
Duration of exhaustion state after sprint overexertion in seconds. Set to 2.3 when cardio limit exceeded. Prevents sprinting and continues sweat effects while active. Core component of stamina system.
private float fartDelay
Timer for posthumous flatulence effect. Set to 0.9 seconds on death with max flatulence. Creates comedic delayed explosion after death. Decrements until triggering fart.
private MuscleTempleFlexEffect flexEffect
Visual effect object for active flex powers. Created for golden light or invulnerability effects. Destroyed on state changes or death. Provides visual feedback for flex abilities.
private float flexInvulnerability
Duration timer for flex-induced invulnerability in seconds. Set to 0.25 during flex power activation. Prevents all damage while active. Strategic defensive window.
private int flexSpecialFrame
Animation frame counter for flex special moves. Increments during air flex, elbow slam, and recovery. Controls sprite progression for special animations. Separate from main frame counter.
private bool gettingUpFromElbowSlam
Recovery state after elbow slam impact. Controls standup animation sequence. Prevents other actions during recovery. Ensures smooth transition from slam.
private bool isAirFlexing
Active state for air flex special move. Controls animation state and physics during aerial flex. Cleared on landing or move completion. Part of flex combo system.
private bool isElbowSlamming
Active state for downward elbow slam attack. Disables wall climbing and ladder interaction. Creates ground impact on landing. Aerial ground pound state.
private bool isFlatulent
Flag indicating active flatulence ability from power-ups. Set when Flatulence modifier greater than 0. Enables fart jumps and death effects. Core comedy mechanic flag.
protected bool performanceEnhanced
Active state flag for performance enhancement from steroids. When true, enables special abilities like enhanced speed/jump, sweat particles, and area grunt effects. Controlled by performanceEnhancedTime duration.
protected float performanceEnhancedCounter
Frame timer for performance enhancement visual and audio effects. Triggers sweat particles and grunt effects every 0.0667 seconds during enhancement or exhaustion. Manages effect frequency.
protected float performanceEnhancedTime
Remaining duration of performance enhancement (steroid) effect in seconds. Set to 10 seconds by default or custom duration via UseSteroidsForDuration. Decrements each frame until reaching zero, then disables enhancement.
protected int performanceGrunCount
Counter for performance enhancement grunt effects timing. Initialized to playerNum*4 when steroids activate. Every 4 grunts panics nearby units, every 16 plays flex sound. Creates escalating intimidation effects.
private float reviveTime
Delay in seconds before automatic revival triggers. Set by DelayedRevive method, can be extended by damage while dead. Compared against death time to initiate holy water revival sequence.
private bool willRevive
Flag indicating pending automatic revival after death. Set by DelayedRevive or holy water mechanics. Prevents life loss and triggers revival when reviveTime expires. Essential for revival system.
Animation & Sprite Systems
Methods
public override void AnimateActualIdleDuckingFrames()
Handles ducking idle animation with elbow slam recovery override. Displays recovery animation when getting up from elbow slam, otherwise uses standard ducking idle frames.
public override void AnimateActualIdleFrames()
Manages idle animation with priority system for special states. Prioritizes elbow slam recovery and air flexing animations over standard idle when hasNewAirFlexFrames is true. Falls back to base idle animation otherwise.
protected override void AnimateActualJumpingFrames()
Complex jumping animation controller managing multiple aerial states. Handles elbow slam (row 14), air flexing, front somersault (row 11, 12 frames), and recovery animations. Adjusts frame rates and gun visibility based on current action.
private void AnimateAirFlexing()
Manages air flex animation sequence on sprite row 13. Creates flex effect during early frames, triggers air jump at frame 3, transitions to somersault at frame 4+. Variable frame timing for dramatic effect.
protected override void AnimateFrozen()
Overrides frozen animation with empty implementation. BroBase characters do not display frozen animations, maintaining normal appearance even when frozen status is applied.
protected override void AnimateGesture()
Animates gestures with special flex power effects. When flexing with appropriate powers, grants temporary invulnerability (0.25s) and creates golden light visual effects. Extends base gesture animation with gameplay benefits.
private void AnimateGettingUpFromElbowSlam()
Handles 4-frame recovery animation from elbow slam on row 15. Fixed 0.07 frame rate, deactivates gun during animation, calls cleanup when complete to restore normal movement state.
public override void FrontSomersault()
Initiates front somersault animation state. Sets frontSomersaulting flag to trigger rolling animation in the animation system.
protected override void IncreaseFrame()
Advances animation frames with special counter for flex animations. Increments flexSpecialFrame when performing air flex, elbow slam, or recovery animations, maintaining separate timing for special moves.
Fields
public bool hasNewAirFlexFrames
Indicates availability of enhanced animation frames for flex moves. Controls which sprite sequences are used. Affects elbow slam, air flex, and recovery animations. Animation quality flag.
Input & Control
Methods
protected override void CheckInput()
Processes gesture button input for teleport cancellation. Destroys remote teleport projectile when gesture button is pressed, allowing players to cancel teleport targeting.
protected override void CheckWhetherShouldClearInput()
Manages input restrictions during special animation states. Clears specific inputs during elbow slam (fire/highfive/special), recovery (movement unless other input detected), and air flexing (all except down when jumping).
protected override void DestroyRemoteProjectile()
Cleans up remote projectile with cooldown update. Calls base destruction logic and sets teleport cooldown timer to manage ability frequency.
Audio System
Methods
protected void PlayBackflipGruntSound()
Plays a specific grunt sound for backflip maneuvers. Uses voice pack backflip grunt clips at a fixed volume of 0.12. Called during chimney flips and other acrobatic moves.
public override void PlayChimneyFlipSound(float volume)
Plays sound during chimney flip/wall jump maneuvers. Combines a backflip grunt sound with the base dash sound effect for the complete audio experience.
Parameters:
- float volume: Volume level for the dash sound component.
protected override void PlayClimbSound()
Plays climbing sound with voice pack support and frequency-based volume reduction. Reduces volume to 66% if another climb sound was played within 1.5 seconds. Uses random volume variation (0.23-0.28) for variety.
protected override void PlayDeathSound()
Plays death sound when the bro dies. Uses voice pack death clips if available at 0.3 volume, otherwise falls back to standard hit sounds. Provides character-specific death audio.
protected override void PlayExitLadderSound()
Plays sound when exiting a ladder. Simply delegates to the jump sound system to provide appropriate footstep audio.
public override void PlayFlexSound(float volumne)
Plays flexing sound during flex gestures. Cycles through an array of flex sounds using a static index to provide variety. Each bro can have multiple unique flex sounds that play in sequence.
Parameters:
- float volumne: Volume level for the flex sound.
public void PlayJetpackSound(float volumne)
Plays jetpack sound effect. Initializes and manages the jetpack sound instance for continuous jetpack audio during flight.
Parameters:
- float volumne: Volume level for the jetpack sound.
protected override void PlayJumpSound()
Plays jump sound with voice pack support and frequency-based volume reduction. Reduces volume to 66% if another jump sound was played within 2.5 seconds to prevent audio spam. Always plays footstep sounds in addition to voice.
public override void PlayPushBlockSound()
Plays grunt sound when pushing blocks with voice pack support. Reduces volume by 40% if called within 1.7 seconds of the last push sound to prevent audio spam during continuous pushing.
protected override void PlayRollLandSound()
Plays a landing grunt sound when the bro lands from a roll. Uses voice pack fall grunt clips with a 2-second cooldown to prevent spam. Volume varies randomly between 0.1-0.12.
public override void PlayThrowHeavySound(float v)
Plays the heavy throwing sound (typically for throwing mooks) with voice pack support. Uses unique bro voice if available and not bypassed, otherwise plays standard throw sound.
Parameters:
- float v: Volume multiplier for the sound playback.
public override void PlayThrowLightSound(float v)
Plays the light throwing sound (typically for grenades) with voice pack support. Uses unique bro voice if available and not bypassed, otherwise plays standard throw sound.
Parameters:
- float v: Volume multiplier for the sound playback.
public override void PlayYeahSound(float volumne, float pitch, bool bypassReverb)
Plays celebration/victory sound with voice pack support. Uses character-specific "yeah" clips if available, otherwise falls back to standard power-up sounds.
Parameters:
- float volumne: Base volume level for the sound.
- float pitch: Pitch modification for the sound.
- bool bypassReverb: Whether to bypass reverb effects.
Properties
public bool BypassNewVoices { get; set; }
Gets whether new voice lines should be bypassed for this bro. Combines a static class-wide bypass flag with an instance-specific bypass flag.
Returns:
bool
: True if voices should be bypassed globally or for this specific bro; otherwise, false.
protected virtual SoundHolderVoice SoundHolderVoice { get; set; }
Gets the voice sound holder for this bro, providing access to unique character voice lines. Virtual property allowing derived bros to provide different voice packs.
Returns:
SoundHolderVoice
: The SoundHolderVoice instance for this bro.
Fields
private static bool byPassNewVoices = false
Global static flag to disable voice pack system for all bros. When true, forces all BroBase instances to use standard sound effects instead of character-specific voice packs. Combines with instance field in BypassNewVoices property.
public bool bypassNewVoicesOnThisBro
Instance-specific flag to disable voice pack for individual bro. Public field allowing per-character voice configuration. Combines with static byPassNewVoices in BypassNewVoices property for flexible audio control.
protected static int flexSoundIndex = 0
Shared static counter for cycling through flex sound variations. Incremented each time any bro plays flex sound, used with modulo to select from flex sound array. Ensures audio variety across all characters.
protected float lastClimbSoundTime
Tracks timestamp of last climbing sound for frequency-based volume control. Reduces climb sound volume to 66% if played within 1.5 seconds of previous climb sound, preventing audio fatigue during continuous climbing.
protected float lastJumpSoundTime
Tracks timestamp of last jump sound playback for volume management. Used to reduce volume to 66% if jumps occur within 2.5 seconds, preventing audio spam while maintaining variety in repeated jump vocalizations.
protected float lastLandSoundTime
Tracks timestamp of last roll landing sound to prevent audio spam. Prevents landing sounds from playing if less than 2 seconds have passed since last landing, managing fall grunt frequency.
protected float lastPushSoundTime
Tracks timestamp of last block pushing sound for volume management. Reduces push grunt volume by 40% if played within 1.7 seconds, preventing repetitive audio during continuous block pushing.
public SoundHolderVoice soundHolderVoice
Stores reference to the voice sound collection component containing character-specific voice clips. Used throughout audio methods for jump grunts, climb sounds, death sounds, and other vocalizations. Accessed via SoundHolderVoice property.
Environmental Interaction
Methods
protected override bool IsOverLadder(float xOffset, ref float ladderXPos)
Checks if the bro is positioned over a ladder for climbing. Prevents ladder interaction during elbow slam state to maintain downward attack momentum.
Parameters:
- out float ladderXPos: Output parameter for the ladder's X position if found.
Returns:
bool
: True if over a ladder and not elbow slamming; otherwise, false.
protected override bool IsOverLadder(float xOffset, ref float ladderXPos)
Checks if the bro is over a ladder with horizontal offset consideration. Prevents ladder grabbing during elbow slam attacks to ensure attack completion.
Parameters:
- float xOffset: Horizontal offset from bro position to check.
- out float ladderXPos: Output parameter for the ladder's X position if found.
Returns:
bool
: True if over a ladder at offset and not elbow slamming; otherwise, false.
protected override void ReachedCheckPoint()
Called when the bro reaches a checkpoint. Performs base checkpoint behavior and attempts to spawn a companion drone.
protected virtual void SpawnDrone()
Spawns a networked drone companion at the player's position. Creates drone 3 units above player, stores reference in currentDrone field for tracking. Virtual method allowing custom drone types in derived bros.
private void TrySpawnDrone()
Attempts to spawn a companion drone for the bro. Only spawns if no current drone exists. Sets tracking flag after spawning.
Fields
protected Drone currentDrone
Reference to active drone companion. Spawned when player has Drones modifier. Checked for null/alive status before spawning new drone. Persistent AI companion.
private float droneCounter = 1f
Unused timer initialized to 1.0 for drone system. Currently has no active functionality. Placeholder for potential future drone mechanics.
private bool hasHadDrone
Tracks if drone has been spawned this session. Triggers initial drone spawn attempt when false. Set true after first successful spawn. One-time spawn flag.
Helper & Utility
Methods
private void AirFlexJump()
Executes flex-powered air jump with dynamic velocity scaling. Time-gated at 0.1s intervals, calculates jump boost between 0.5x-1.8x based on current velocity. Creates land effect and consumes flex jump charge.
protected void CreateJetpackFlames(Vector3 currentJetpackDirection)
Creates vertical jetpack flame particles for upward thrust visualization. Generates dual plume effects positioned at ±2.5 units horizontally, with -70 downward velocity creating realistic exhaust. Particles last 0.4 seconds with 1.3x fade rate.
Parameters:
- Vector3 currentJetpackDirection: Direction vector for jetpack thrust orientation.
protected void CreateJetpackFlamesDash(ref Vector3 lastFlamePos)
Creates continuous flame trail during jetpack dash movements. Calculates path between positions, generates particles at 2 unit intervals up to 50 units maximum. Updates reference position for smooth trail continuity across frames.
Parameters:
- out Vector3 lastFlamePos: Reference to last flame position for trail calculation.
protected void CreateJetpackFlamesHorizontal(Vector3 currentJetpackDirection)
Creates horizontal jetpack flame particles for lateral movement. Similar to vertical flames but with -10 downward velocity for wider spread pattern. Provides visual feedback for horizontal jetpack maneuvers.
Parameters:
- Vector3 currentJetpackDirection: Direction vector for jetpack thrust orientation.
protected void CreateSweatParticle()
Creates visual sweat particle effects near the bro. Generates water drip particles with random position offset within a unit circle, adjusted for ducking state. Particles inherit some of the bro's velocity for realistic movement.
protected virtual bool MustSync()
Indicates whether this character requires network synchronization. Virtual method always returning true for BroBase, ensuring all player characters are synchronized in multiplayer.
Returns:
bool
: Always returns true.
protected override void SetupThrownMookVelocity(out float XI, out float YI)
Configures the throwing velocity for captured mooks. Uses stronger throw velocity (360 horizontal, 120 vertical) when performance enhanced, otherwise uses standard velocity (210 horizontal, 120 vertical). Adds portion of current velocity to throw.
Parameters:
- out float XI: Output horizontal velocity for the thrown mook.
- out float YI: Output vertical velocity for the thrown mook.
private void StartElbowSlam()
Initiates elbow slam attack sequence with physics modifications. Disables wall climbing, sets animation timing (0.066f), adjusts downward velocity (minimum 210), and plays flex sound. Prepares for ground pound attack.
protected virtual void StartTeleportFlexing()
Initiates teleport targeting with 0.2s cooldown check. Spawns RemoteTeleportTarget projectile for position marking if no existing projectile and cooldown expired. Activates bro and manages projectile reference.
private void TryCreateFlexEffect()
Creates visual effects for flex powers when not already active. Spawns golden light effect for FlexGoldenLight power or invulnerability effect for FlexInvulnerability power. Prevents duplicate effects by checking flexEffect null state.
Fields
public static List<TestVanDammeAnim> bros = new List<TestVanDammeAnim>()
Static registry of all active BroBase instances in the game. Automatically managed through Awake/OnDestroy lifecycle. Used by Map.GetNearestHero and other systems for hero detection, targeting, and proximity checks. Essential for multiplayer hero tracking and AI target acquisition.
private bool jetPackActive
Active state flag for jetpack thrust effect. When true, provides upward velocity and creates flame particles. Controlled by jetPackTime duration and manages thrust physics.
private bool jetPackAvailable
One-time use flag for jetpack power-up availability. Set false when consumed via UseJetpack. Reset on landing. Gates access to jetpack ability.
protected float jetPackFlameCounter
Timer for jetpack flame particle spawning. Triggers effects every 0.0225 seconds. Active during jetpack use and JetpackPunch attacks. Visual effect timing control.
public SpriteSM jetPackSprite
Visual sprite component for jetpack equipment display. Activated when jetpack is used, deactivated when jetPackTime expires. Provides visual feedback for jetpack power-up state.
private float jetPackTime
Active jetpack thrust duration timer. Set to 0.66 seconds on activation. Different thrust levels: extra boost above 0.36s, normal boost above 0.16s. Controls jetpack physics phases.