MookDog - alexneargarder/Broforce-Docs GitHub Wiki

MookDog

Table of Contents

Unity Lifecycle & Setup

Methods

protected override void Start()

Initializes the MookDog when spawned, handling mega dog transformation if isMegaDog flag is set. Ensures the transformation process starts correctly by resetting flags and calling TransformIntoMegaDog.


protected override void Update()

Updates the MookDog's state each frame, managing the damagedDisableAttackTime counter that prevents attacks after taking melee damage. Decrements the timer and calls base Update for standard unit behavior.


Combat & Damage

Methods

public override void CreateGibEffects(DamageType damageType, float xI, float yI)

Creates death gibbing effects, using special megaDogGibs if the dog is in mega form. Ensures appropriate visual effects match the current dog variant when destroyed.

Parameters:

  • DamageType damageType: Type of damage that caused the gibbing
  • float xI: Horizontal force for gib physics
  • float yI: Vertical force for gib physics

public override void Damage(int damage, DamageType damageType, float xI, float yI, int direction, MonoBehaviour damageSender, float hitX, float hitY)

Processes damage taken by the MookDog, setting a 0.3 second attack disable timer when hit by melee, knife, knock, or blade damage types. This prevents the dog from immediately counter-attacking after being struck in close combat.

Parameters:

  • int damage: Amount of damage to inflict
  • DamageType damageType: Type of damage being applied
  • float xI: Horizontal knockback force
  • float yI: Vertical knockback force
  • int direction: Direction of the damage source
  • MonoBehaviour damageSender: The MonoBehaviour that caused the damage
  • float hitX: X coordinate of the hit location
  • float hitY: Y coordinate of the hit location

protected override void FallDamage(float yI)

Applies fall damage to the MookDog with damage reduction in hard mode. This override implements a special damage mitigation system where every other fall damage instance is ignored in hard mode, effectively halving fall damage frequency. Uses a fallCount counter to track the number of fall damage events and only applies damage on even-numbered occurrences when playing in hard mode.

Parameters:

  • float yI: The vertical impact velocity used to calculate fall damage severity

protected override void Jump(bool wallJump)

Executes the jump action for the MookDog. This override calls the base jump implementation without any modifications. The method maintains the standard jumping behavior from the parent Mook class while allowing for potential future MookDog-specific jump customizations.

Parameters:

  • bool wallJump: True if performing a wall jump, false for a regular ground jump

public override void Knock(DamageType damageType, float xI, float yI, bool forceTumble)

Applies knockback to the MookDog by calling the base Knock implementation. Maintains standard knockback behavior without any special modifications.

Parameters:

  • DamageType damageType: Type of damage causing the knockback
  • float xI: Horizontal knockback force
  • float yI: Vertical knockback force
  • bool forceTumble: Whether to force the unit into a tumbling state

protected override void RunFiring()

Executes the MookDog's melee bite attack when firing. Temporarily sets invulnerable during the attack, hits living units within 6 units horizontally at Y+4 offset for 3 melee damage, and plays attack sound on successful hit.


Fields

protected float damagedDisableAttackTime

Time remaining during which the MookDog cannot perform attack actions after being damaged by melee attacks. Set to 0.3 seconds when hit by melee, knife, knock, or blade damage types. This timer prevents the dog from immediately counter-attacking when struck by close-range weapons, creating a brief vulnerability window. Decrements each frame and is checked during input processing to disable fire actions.


protected int fallCount

Counter tracking the number of times this MookDog has taken fall damage. Used in conjunction with hard mode difficulty to reduce fall damage frequency. When in hard mode, only even-numbered fall counts (fallCount % 2 == 0) result in actual damage being applied, effectively halving the fall damage rate.


Special Abilities

Methods

protected override void PressSpecial()

Handles special ability button press, stopping any howling animation before calling base special press behavior. Ensures howling doesn't interfere with other special actions.


public override void StartEatingCorpse()

Begins the corpse eating behavior by resetting the corpseEatingCount to 0. Called when the dog starts consuming a fallen unit to potentially transform into mega form.


public virtual void TransformIntoMegaDog()

Transforms the regular MookDog into a powerful MegaDog variant. Increases sprite size to 48x48, health to 15, movement speed by 30%, jump force by 15%, and adjusts collision bounds. Triggers a howling animation and disturbs nearby wildlife within 200 units.


protected override void UseSpecial()

Empty implementation that prevents any special ability usage. MookDogs don't have active special abilities beyond their passive corpse-eating transformation.


Fields

protected int corpseEatingCount

Counter tracking the number of bite actions performed while eating corpses. Increments with each successful bite animation frame during the corpse-eating special ability. When this count reaches corpseEatingSatisfactionCount (default 16), the MookDog transforms into a MegaDog. Resets to 0 when starting to eat a new corpse.


public int corpseEatingSatisfactionCount = 16

The number of successful corpse bites required to transform into a MegaDog. Defaults to 16 bites. When corpseEatingCount reaches this value during the eating animation, the transformation is triggered. This value can be adjusted to make transformation easier or harder to achieve.


protected bool isHowling

Flag indicating whether the MookDog is currently performing its howling animation. Set to true when transforming into a MegaDog to play the transformation howl sequence. During howling, the dog plays a special animation sequence and power-up sound. The howl completes after frame 14 of the animation sequence.


public bool isMegaDog

Flag indicating whether this MookDog has transformed into its more powerful MegaDog variant. When true, the dog has increased health (15), larger size (48x48 sprites), faster movement speed (1.3x multiplier), and uses different death effects. Transformation occurs after eating enough corpses or can be set during initialization.


public GibHolder megaDogGibs

The gib holder containing death particle effects specific to the MegaDog variant. When a MegaDog is destroyed, this gib set is used instead of the standard dog gibs to create appropriately scaled death effects. The system swaps to these gibs in CreateGibEffects when isMegaDog is true.


public Material upgradedMaterial

The material applied to the MookDog's renderer when it transforms into a MegaDog. This material replaces the standard appearance to visually indicate the upgraded state. Applied during the TransformIntoMegaDog process along with other visual changes like increased sprite size.


Animation & Sprite Systems

Methods

public override void AnimateActualIdleDuckingFrames()

Animates the MookDog's idle ducking frames with special handling for hiding and reveal animations. When animatingRevealPosition is true, plays a 15-frame reveal sequence with variable frame rates. When the AI is in hiding state, plays a 12-frame hiding animation loop. Otherwise delegates to the base implementation for standard idle ducking animations. The reveal animation includes pauses at frames 4, 6, and 9 for dramatic effect.


public override void AnimateActualIdleFrames()

Animates idle stance, with special electrified animation frames when shocked or under plasma effects. Uses frames 6-7 on row 5 for electrified state, otherwise delegates to base idle animation.


protected override void AnimateActualNewRunningFrames()

Animates the MegaDog's running frames using an 8-frame cycle on sprite row 4. Used when the dog is in mega form and actively running.


protected virtual void AnimateActualUnawareRunningFrames()

Animates the unaware running state using an 8-frame cycle on sprite row 2. Used for calm movement when the dog hasn't detected enemies.


protected override void AnimateImpaled()

Sets the sprite position for the impaled death animation based on whether this is a regular MookDog or MegaDog. MegaDogs use sprite position (960, 48) while regular dogs use position (638, 32). This provides size-appropriate impalement sprites for both variants.


protected override void AnimateRunning()

Manages running animations based on the dog's current state. Adjusts speed and frame rate for: burning/blind/scared (70% speed), alerted (full speed with aware animations), or unaware (slower casual movement). Handles both regular and mega dog sprite variations.


protected override void AnimateSpecial()

Animates special actions including howling (mega transformation) and corpse eating. Howling uses a 14-frame intro then loops 2 frames. Corpse eating alternates between 2 frames, dealing bite damage and creating blood effects every other frame. Transforms to mega dog after eating enough (determined by corpseEatingSatisfactionCount).


protected override void ChangeFrame()

Updates the current animation frame, switching to death animation if health drops to 0 or below. Otherwise delegates to base frame change logic for standard animations.


Character State & Effects

Methods

public override void Dance(float time)

Initiates celebration dance animation, canceling any ongoing howling or corpse eating. Clears AI action queue and resets special ability states before calling base dance behavior.

Parameters:

  • float time: Duration of the dance animation

Input & Control

Methods

protected override void CalculateZombieInput()

Calculates AI-controlled zombie movement, making the dog jump forward when attempting to attack. Sets movement direction based on facing and maintains forward momentum during attack sequences with a 0.5 second delay.


protected override void CheckInput()

Processes input controls, disabling fire/attack input if damagedDisableAttackTime is active. Prevents the dog from attacking immediately after taking melee damage.


Environmental Interaction

Methods

protected override bool CanPassThroughBarriers()

Determines if the dog can pass through barrier blocks. Returns true when dead, knocked back with sufficient force (>1 horizontal blast), blinded, or scared, allowing passage through normally solid barriers.

Returns:

  • bool: True if the dog can pass through barriers in its current state

Audio System

Methods

public override void PlayGreetingSound()

Plays greeting/alert sound and bothers nearby mooks within 80 horizontal and 32 vertical units. Alerts 5 nearby enemies to the player's presence when the dog spots them.


protected override void PlayJumpSound()

Plays the special2 sound effect when jumping, with randomized pitch between 0.94 and 1.06 for variation. Creates more natural jump sound variety.


Unit Management

Methods

public override void RegisterUnit()

Registers this MookDog with the game's unit tracking system. Uses simplified registration without networking features for reliable modding compatibility.


AI Awareness

Methods

public override void FetchObject(Transform fetchObject)

Directs the dog's AI to fetch or pursue a specific object. Delegates the fetch behavior to the enemyAI component if available.

Parameters:

  • Transform fetchObject: The transform of the object to fetch

protected override void GetEnemyMovement()

Calculates AI-driven movement patterns, disabling attack behavior if damagedDisableAttackTime is active. Ensures the dog retreats briefly after taking melee damage before resuming pursuit.


Fields

public float awareMegaRunSpeed = 135f

Movement speed for MegaDogs when alerted to player presence. Set to 135 units per second. Applied when the enemy AI is alerted and useNewFrames is true (indicating MegaDog status). Slightly faster than regular aware speed to reflect the MegaDog's enhanced capabilities.


public float awareRunSpeed = 130f

Movement speed for regular MookDogs when alerted to player presence. Set to 130 units per second. Used when the enemy AI is in an alerted state and useNewFrames is false. This increased speed helps the dog close distance on detected players more effectively than its unaware patrol speed.


public float unawareMegaRunSpeed = 125f

Default patrol movement speed for MegaDogs when not alerted. Set to 125 units per second. Applied during patrol when useNewFrames is true but the AI isn't alerted. Even while unaware, MegaDogs move slightly faster than regular dogs due to their enhanced physical capabilities.


public float unawareRunSpeed = 120f

Default patrol movement speed for regular MookDogs when not alerted. Set to 120 units per second. Used during normal patrol behavior when the AI hasn't detected players and useNewFrames is false. This slower speed represents casual movement while searching for threats.