TestVanDammeAnim - alexneargarder/Broforce-Docs GitHub Wiki
TestVanDammeAnim
Table of Contents
- Unity Lifecycle & Setup
- Combat & Damage
- Methods
- CancelMelee
- CheckBustCage
- CheckPlasmaDeath
- CreateGibEffects
- CreateGibs
- Damage
- DealWithBounce
- Death
- DestroyRemoteProjectile
- FallDamage
- FindNearbyMook
- FireWeapon
- Gib
- GibRPC
- IsLockedInMelee
- Knock
- KnockSimple
- ReleaseAlien
- ReleaseGrenadeRPC
- ReleaseHeldObject
- RunFiring
- RunIndependentMeleeFrames
- RunKnifeMeleeMovement
- RunMelee
- SetMeleeType
- SetupThrownMookVelocity
- SetVelocity
- SpawnPrimaryProjectile
- StartFiring
- StartMelee
- StopFiring
- ThrowBackGrenade
- ThrowBackMook
- ThrowGrenade
- TriggerBroFireEvent
- TriggerBroMeleeEvent
- TriggerBroSpecialEvent
- UseFire
- Fields
- _invulnerableTime
- addedDeathMatchScore
- cancelMeleeOnChangeDirection
- canDoIndependentMeleeAnimation
- canGib
- dashingMelee
- deadTimeCounter
- disembowelHoldFrames
- doingMelee
- fireCounter
- fireDelay
- firedWhileInvulnerable
- fireRate
- gibs
- gibThreshold
- hasPlayedMissSound
- heroThatKilledMeIndex
- iDiedAtPosition
- impaledByChainSaw
- impalementCollider
- jumpingMelee
- lastAlertTime
- meleeChosenUnit
- meleeFollowUp
- meleeHasHit
- projectileTime
- remoteCar
- remoteProjectile
- skinnedMookOnMyBack
- specialCounter
- standingMelee
- willComeBackToLife
- willComebackToLifeTime
- Methods
- Special Abilities
- Methods
- AddSpecialAmmo
- Airdash
- AirDashDown
- AirDashLeft
- AirDashRight
- AirDashUp
- CanUseJetpack
- GetRemoteControlCar
- GetSpecialAmmo
- IsAmmoFull
- MustUsePockettedSpecialAmmo
- PickupPockettableAmmo
- PlayAidDashSound
- PlayAirDashChargeUpSound
- ResetSpecialAmmo
- RunAirDashing
- RunDownwardDash
- RunLeftAirDash
- RunRightAirDash
- RunUpwardDash
- SetAirdashAvailable
- SetAirDashLeftSpeed
- SetAirDashRightSpeed
- SetHeldObjectPos
- SetRemoteProjectile
- SetSpecialAmmoRPC
- StartPockettedSpecial
- UseJetpack
- UsePockettedSpecial
- UseSpecial
- UseSteroidsNetworked
- UseSteroidsNetworkedForDuration
- Properties
- Fields
- Methods
- Position & Physics
- Methods
- AddParentedDiff
- AddSpeedLeft
- AddSpeedRight
- AirJump
- ApplyFallingGravity
- ApplyNormalGravity
- ApplyQuicksandGravity
- AssignGroundTransform
- AssignParentedPos
- AssignWallTransform
- AttachToZipline
- CalculateCollumnRowFromTransform
- CalculateGridPosition
- CalculateGroundHeight
- CalculateMovement
- CanAirDash
- CanBeAffectedByWind
- CanJumpOffGround
- CanTouchGround
- CheckDucking
- ClampSpeedPressingLeft
- ClampSpeedPressingRight
- ClampWallDragYI
- ConstrainSpeedToSidesOfScreen
- DontSlipOverEdges
- EvaluateIsJumping
- GetFollowPosition
- GetGroundHeightGround
- GetGroundLayer
- GetParentedToPos
- GetParentedToTransform
- HitLeftWall
- HitRightWall
- IsGroundBelow
- IsGroundBelow
- IsGroundBelowAtXOffset
- IsNearGround
- IsOilyBelow
- IsOnGround
- IsWallInFront
- IsWallInFrontOfHead
- Jump
- NotPressingJump
- OpenParachute
- ParachuteLandedOn
- PressDown
- RaycastGroundSingleSquare
- ResetToOriginalJumpForce
- RunAirFriction
- RunCheckHanging
- RunDeadGravity
- RunFallen
- RunFalling
- RunGroundFriction
- RunHanging
- RunImpaledMovement
- RunMovement
- RunStrungByPredabroMovement
- SetActionstateToIdle
- SetActionStateToJumping
- SetCanParachute
- SetParachuteDelay
- SetPositionAndVelocity
- ShiftUnitWithParent
- StartDucking
- StopAirDashing
- StopDashing
- StopDucking
- TeleportOnScreenCounter
- Tumble
- UseAttackJumpForceForSeconds
- Properties
- Fields
- _jumpForce
- airDashDelay
- airdashDirection
- airdashDownAvailable
- airdashLeftAvailable
- airdashMaxTime
- airdashRightAvailable
- airdashTime
- airdashUpAvailable
- attackJumpForce
- attackJumpForceSecondsRemaining
- belowScreenCounter
- bouncyJumpMultiplyer
- canAirdash
- canCeilingHang
- canDash
- canPushBlocks
- canTouchCeiling
- canTouchLeftWalls
- canTouchRightWalls
- canWallClimb
- ceilingHeight
- chimneyFlip
- chimneyFlipConstrained
- chimneyFlipDirection
- chimneyFlipFrames
- constrainedLeft
- constrainedRight
- dashing
- dashSpeedM
- dashTime
- defaultAirdashDelay
- delayedDashing
- doodadCurrentlyHangingFrom
- doubleJumpsLeft
- downTapTime
- feetWidth
- frictionM
- graceJumping
- GRAVITY
- gravityWaterDanmping
- groundHeight
- halfWidth
- hangGrace
- hangGraceTime
- hasDashedInAir
- JUMP_TIME
- jumpTime
- lastCollumn
- lastDashSpeedM
- lastJumpTime
- lastLandTime
- lastParentedToTransform
- lastParentPosition
- lastParentWorldPos
- lastRow
- ledgeGrapple
- ledgeOffsetY
- leftTapTime
- maxFallSpeed
- maxWallClimbYI
- minDashTapTime
- noclipSpeed
- oldJumpForce
- originalMaxFallSpeed
- parachuteTemporyPositionY
- parentedDiff
- parentHasMovedTime
- parentVelocityInheritM
- rightTapTime
- rumbleAmountPerShot
- screenMaxX
- screenMaxY
- screenMinX
- screenMinY
- specialAttackXIBoost
- specialAttackYIBoost
- speed
- standingHeadHeight
- useAttackJumpForceForAttack
- wallClimbing
- wallClimbingWallTransform
- wallClimbingWallTransformLocalPos
- wallDrag
- wallDragTime
- wasConstrainedLeft
- wasConstrainedRight
- wasDashing
- wasLedgeGrapple
- wasWallClimbing
- wasWallDragging
- waterDampingX
- waterDampingY
- xIAttackExtra
- xIBlast
- xIT
- yIBlast
- yIT
- Methods
- Animation & Sprite Systems
- Methods
- AnimateActualDuckingRunning
- AnimateActualIdleDuckingFrames
- AnimateActualIdleFrames
- AnimateActualJumpingDuckingFrames
- AnimateActualJumpingFrames
- AnimateActualNewRunningFrames
- AnimateAirdash
- AnimateAirdashDown
- AnimateChimneyFlip
- AnimateHanging
- AnimateHighFiveHold
- AnimateHighFiveRelease
- AnimateIdle
- AnimateImpaled
- AnimateImpaledByChainSaw
- AnimateJumping
- AnimateLedgeGrapple
- AnimateMelee
- AnimateOnBackOffUnit
- AnimatePockettedSpecial
- AnimatePushing
- AnimateRolling
- AnimateRunning
- AnimateSpecial
- AnimateSpecial2
- AnimateSpecial3
- AnimateSpecial4
- AnimateStrungUpFrames
- AnimateThrowingHeldObject
- AnimateZipline
- CreateFaderTrailInstance
- RunGun
- SetGunSprite
- SetSpriteOffset
- Properties
- Fields
- _frozenGunMaterial
- _frozenMaterial
- _oilyGunMaterial
- _oilyMaterial
- blood
- currentGesture
- defaultMaterial
- frameRate
- gunCounter
- gunFrame
- gunMaterial
- gunSprite
- gunSpriteHangingFrame
- gunSpritePixelHeight
- gunSpritePixelWidth
- hangingOneArmed
- heroTrail
- heroTrailPrefab
- instantiatedSkeleton
- knifeHand
- lastT
- meltingSprite
- meshRenderer
- runningFrameRate
- sprite
- spriteOffset
- spritePixelHeight
- spritePixelWidth
- useDashFrames
- useDuckingFrames
- useLadderClimbingTransition
- useNewDuckingFrames
- useNewFrames
- useNewHighFivingFrames
- useNewKnifeClimbingFrames
- useNewKnifingFrames
- useNewLadderClimbingFrames
- useNewLedgeGrappleFrames
- useNewPushingFrames
- useNewThrowingFrames
- wasHangingMoving
- yScale
- Methods
- Character State & Effects
- Methods
- AlertNearbyMooks
- AnimateFrozen
- Blind
- Blind
- Boost
- BrosMustFailToWin
- CalculateZombieInput
- CanBeThrown
- CanFreeze
- CheckDestroyed
- CheckFacingDirection
- CheckNotifyDeathType
- CopyInput
- CreateElectricShockPuff
- CreateSkeleton
- Dance
- DelayedRevive
- DestroyUnit
- Disable
- FireFlashAvatar
- Freeze
- HideAndDisableCharacter
- Impale
- IsExitingDoor
- IsFlexing
- IsHanging
- IsIncapacitated
- IsInQuicksand
- Melt
- MustBroFailToWin
- RecallBro
- ReceiveHeroKillReport
- ReduceLives
- Reenable
- ReplaceWithSkinnedInstance
- RestartBubble
- RestartBubble
- Revive
- RollOnto
- RunAvatarFiring
- RunAvatarRunning
- RunImpaledBlood
- RunTrail
- SetGibThreshold
- SetImmuneToOutOfBounds
- SetInvulnerable
- SetSpawnState
- SetWillComebackToLife
- ShowAndEnableCharacter
- ShowCharacterInternal
- SkinUnit
- SprayBlood
- Stop
- StopBeingStunned
- StopBubble
- Stun
- Stun
- SuckIntoPortal
- TempInvulnerability
- TimeBroBoost
- UnFreeze
- Unimpale
- Unrevive
- Unrevive
- WhereDidIDie
- YouKilledMe
- Properties
- Fields
- avatarAngryTime
- avatarGunFireTime
- blindCounter
- bloodCountAmount
- bloodTime
- bloodTimeOut
- canBeCoveredInAcid
- canBeStrungUp
- canDuck
- canUnFreeze
- controllingProjectile
- controllingProjectileDelay
- dancingFrames
- dancingFramesSheetPosition
- dancingTime
- deadHeadHeight
- deadWaistHeight
- deathSoundVolume
- doRollOnLand
- ducking
- duckingHeadHeight
- duckingToeHeight
- duckingWaistHeight
- firstFrame
- frozenTime
- halo
- HidingPlayer
- idleTime
- immuneToOutOfBounds
- impaledBy
- ImpaledByTransform
- impaledCounter
- impaledDamage
- impaledDirection
- impaledLocalPos
- impaledPosition
- impaleXOffset
- impaleYOffset
- isParachuteActive
- isSkinnedMook
- lastDamageType
- lastHitSoundTime
- meltDuration
- parachute
- parachuteDelay
- pitchShiftAmount
- pushingTime
- recallCounter
- recalling
- reducedLife
- rollingFrames
- rollingTime
- showGestureTimer
- spurtCount
- standingToeHeight
- standingWaistHeight
- stunTime
- stunVocalDelay
- teaBagCheatEnabled
- timeBroBoostTime
- toeHeight
- waistHeight
- xBoxControlled
- Methods
- Input & Control
- Methods
- AnyInput
- CanUseSwitch
- CheckDashing
- CheckInput
- CheckTriggerActionInput
- CheckWhetherShouldClearInput
- ClearAllInput
- ClearFireInput
- DebugShowInput
- GetEnemyMovement
- GetSprintValue
- IsPressingDown
- IsPressingLeftOrRight
- MustIgnoreHighFiveMeleePress
- PressDashButton
- PressHighFiveMelee
- PressSpecial
- PressSpecial2
- ReleaseDashButton
- ReleaseFire
- ReleaseSpecial
- RunForcedInput
- StopLeftRightInputFromHanging
- Properties
- Fields
- airDashJumpGrace
- blockMovementForGesture
- buttonGesture
- buttonHighFive
- buttonJump
- buttonTaunt
- canFireDelay
- climbButton
- dashButton
- down
- fire
- holdDownTime
- holdLeftTime
- holdRightTime
- holdStillTime
- holdUpTime
- lastButtonJumpTime
- left
- pressedJumpInAirSoJumpIfTouchGroundGrace
- right
- special
- specialDown
- sprint
- up
- wasButtonGesture
- wasButtonHighFive
- wasButtonJump
- wasButtonTaunt
- wasClimbButton
- wasdashButton
- wasDown
- wasFire
- wasLeft
- wasRight
- wasSpecial
- wasSpecialDown
- wasSprint
- wasUp
- wasXBoxFireDown
- Methods
- Environmental Interaction
- Methods
- AssignPushingTime
- CanCheckClimbAlongCeiling
- CanDoRollOnLand
- CanTouchCeiling
- CheckClimbAlongCeiling
- CheckForCheckPoints
- CheckForQuicksand
- CheckForQuicksandDeath
- CheckForTraps
- CheckRescues
- ConstrainToCeiling
- ConstrainToFloor
- ConstrainToFragileBarriers
- ConstrainToMookBarriers
- ConstrainToWalls
- HitCeiling
- IsAboveLadder
- IsInStealthMode
- IsNearbyLadder
- IsOverFinish
- IsOverLadder
- IsOverLadder
- IsSubmergedInPool
- IsSurroundedByBarbedWire
- IsWithinGrass
- Land
- LandInOil
- LeaveOil
- LedgeGrapple
- PickupPickupables
- PushGrassAway
- ReachedCheckPoint
- RollOnLand
- RunBlindStars
- RunClimbingLadder
- RunHasLeftOilTest
- RunZombieEffects
- StartHanging
- StopHanging
- StopRolling
- Properties
- Fields
- armUpInAnticipationWallClimb
- barrierLayer
- bossBlockPieceCurrentlyStandingOn
- breakDoorsOpen
- canChimneyFlip
- canLedgeGrapple
- currentLadderBlock
- fragileLayer
- groundLayer
- groundTransform
- groundTransformLocalPos
- isInOil
- isInQuicksand
- knifeClimbStabHeight
- ladderClimbingTransitionFrames
- ladderLayer
- ladderX
- lastKnifeClimbStabY
- newRaycastHit
- oilLevel
- openDoorsLayer
- platformLayer
- prevLadderBlock
- quicksandChokeCounter
- raycastHit
- raycastHitWalls
- switchesLayer
- victoryLayer
- wallClimbAnticipation
- wasInQuicksand
- Methods
- Audio System
- Methods
- CanLaugh
- PlayAttack2Sound
- PlayAttack3Sound
- PlayAttack4Sound
- PlayAttackSound
- PlayAttackSound
- PlayAttractedSound
- PlayBassDropShortSound
- PlayBassDropSoundSound
- PlayBleedSound
- PlayBurnSound
- PlayChestBurstSound
- PlayChimneyFlipSound
- PlayChokeSound
- PlayClimbSound
- PlayConfusedSound
- PlayDashSound
- PlayDeathGargleSound
- PlayDeathSound
- PlayDecapitateSound
- PlayDizzieSound
- PlayExitLadderSound
- PlayFallDamageSound
- PlayFallDamageSound
- PlayFallSound
- PlayFizzleSound
- PlayFlexSound
- PlayFootStepSound
- PlayFreezeScreamSound
- PlayGibSound
- PlayGreetingSound
- PlayHighFiveSound
- PlayHitSound
- PlayHurtSound
- PlayJumpSound
- PlayKnifeClimbSound
- PlayLandSound
- PlayLaughterSound
- PlayMuffledScreamsSound
- PlayPanicSound
- PlayPowerUpSound
- PlayPowerUpSound
- PlayPushBlockSound
- PlayResurrectionSound
- PlayRollLandSound
- PlaySpecial2Sound
- PlaySpecial2Sound
- PlaySpecial3Sound
- PlaySpecial3Sound
- PlaySpecial4Sound
- PlaySpecialAttackSound
- PlaySpecialSound
- PlaySpecialSound
- PlaySpecialSound
- PlaySpecialSound
- PlayStunnedSound
- PlayThrowHeavySound
- PlayThrowLightSound
- PlayYeahSound
- PlayYeahSound
- PlayZappedSound
- RunWallDraggingAudio
- SetCurrentFootstepSound
- Properties
- Fields
- Methods
- Unit Management
- Helper & Utility
- Character Setup & Configuration
- Alien Infection System
- Acid Coverage System
- Methods
- AnimateActualDeath
- AnimateClimbingLadder
- AnimateClimbingLadderTransition
- AnimateDancingFrames
- AnimateDeath
- AnimateFallen
- AnimateFallingDeath
- AnimateGesture
- AnimateInseminationFrames
- AnimateWallAnticipation
- AnimateWallClimb
- AnimateWallDrag
- ApplyWallClimbingGravity
- ChangeFrame
- CheckAirDash
- CheckHighFive
- CoverInAcid
- CoverInAcidRPC
- CreateHighFiveEffects
- ForceChangeFrame
- HasBeenCoveredInAcid
- HighFiveBoost
- IncreaseFrame
- IsGesturing
- PlayFootStepSound
- PlayFootStepSound
- PlayLongGrassSound
- ReleaseHighFive
- RemoveAcid
- RemoveAcidRPC
- RunCoveredInAcid
- RunStepOnWalls
- SetGestureAnimation
- StartDashing
- StartHighFive
- TriggerFlexEvent
- TryConnectHighFive
- Fields
- acidMeltTimer
- acidParticleTimer
- hasBeenCoverInAcid
- hasMelted
- high5Bubble
- highFive
- highFiveBoost
- highFiveBoostM
- highFiveBoostTime
- highfiveHoldTime
- highFiveNoBoost
- highFiveNoBoostTime
- holdingHighFive
- ignoreHighFivePressTime
- lastRecoveredFromAcidTime
- player1Bubble
- player2Bubble
- player3Bubble
- player4Bubble
- releasingHighFive
- showHighFiveAfterMeleeTimer
- successfulHighFive
- successfulHighFiveActiveBro
- wasHighFive
- Methods
- Kick System
Unity Lifecycle & Setup
Methods
protected virtual void AddBoxCollider()
Adds or configures a BoxCollider component with character-specific collision dimensions. Sets different box sizes and centers for various enemy types (Xenomorph, FaceHugger, etc.) with default humanoid dimensions as fallback.
protected virtual void AddRigidbody()
Adds or configures a Rigidbody component for physics simulation. Sets the rigidbody to kinematic mode with gravity disabled for manual physics control.
protected override void Awake()
Unity lifecycle method that initializes TestVanDammeAnim. Sets up sprite systems, parachute functionality, collision layers, materials, and core physics components required for character operation.
protected virtual void FixedUpdate()
Unity fixed update method that runs oil test checking at fixed intervals.
protected override void LateUpdate()
Unity lifecycle method for post-frame updates. Handles input bit preservation, inseminator unit synchronization, map disable area extension, and quicksand checking.
protected override void OnDestroy()
Unity lifecycle callback when the GameObject is destroyed. Calls base implementation for cleanup.
private void OnDisable()
Unity lifecycle callback when the component is disabled. Empty implementation for potential override.
private void OnEnable()
Unity lifecycle callback when the component is enabled. Empty implementation for potential override.
public virtual void RegisterUnit()
Registers this unit with the Map system for game tracking and management.
public override void RunSync()
Network synchronization method that updates the unit's position. Calls base synchronization and updates position based on current transform.
protected void SetDefaultGroundLayer()
Sets up the default ground collision layer mask including Ground, LargeObjects, and IndestructibleGround layers for ground detection and collision checking.
protected virtual void SetDeltaTime()
Updates the frame delta time with clamping to prevent large time steps. Stores previous frame time and clamps current time to maximum of 0.0334 seconds.
protected virtual void SetHighFiveBoostDeltaTime()
Sets modified delta time during high-five boost effects. Applies different time multipliers based on time scale and special boost conditions.
protected void SetStrictGroundLayer()
Sets up a strict ground collision layer mask including only Ground and IndestructibleGround layers, excluding LargeObjects for more restrictive ground detection.
protected virtual void Start()
Unity lifecycle method that handles game mode-specific initialization. Configures special ammo based on game mode (deathmatch, procedural generation, campaign), sets up sound system, avatar states, and initial invulnerability.
protected virtual void Update()
Core Unity lifecycle method that executes the main update loop for TestVanDammeAnim each frame. Processes essential character systems in this execution order:
-
Acid coverage effects - Visual and damage processing for acid-covered characters
Delta time management - Frame timing with high-five boost support
-
Input processing - Handle player input or trigger action control
-
Status effect timers - Stun, freeze, zombie revival, and death counters
-
Animation frame management - Sprite frame advancement and timing
-
Movement calculation and execution - Core physics and movement processing
-
Special movement states - Impaled, strung-up, or platform movement
-
Combat systems - Weapon management, firing, and melee processing
-
Hero-specific systems - Checkpoints, rescues, enemy alerting, item pickup
-
Invulnerability management - Temporary invincibility and revival timing
-
Alien infection system - Insemination mechanics and chest-bursting
-
Environmental effects - Ducking, grass interaction, boundary checks
-
Audio and visual effects - Wall dragging sounds, trails, freeze shaders
-
Player management - Kick system and recall mechanics
-
Parachute system - Deployment timing and physics modification This method coordinates all core character functionality and represents the main execution loop for character behavior.
Combat & Damage
Methods
protected virtual void CancelMelee()
Cleanly exits melee state and resets all melee-related variables. Clears all melee flags, removes target reference, and intelligently determines next action state based on current conditions (preserves ladder climbing, sets jumping if airborne, running if moving, or idle).
protected virtual bool CheckBustCage()
Checks if there's a cage in front of the player that can be broken. Performs a raycast within 16 units to detect cage components.
Returns:
bool
: True if a cage is found that can be busted, false otherwise
public virtual bool CheckPlasmaDeath(ref float xGibI, ref float yGibI)
Handles special plasma/vaporization death effects when plasma damage is 1 or greater. Creates white flash effects and for explosion damage types, generates area damage and smoke effects while shaking the camera and disturbing nearby wildlife. Returns true if plasma death occurred.
Parameters:
- out float xGibI: Reference to horizontal gib velocity, modified for plasma deaths
- out float yGibI: Reference to vertical gib velocity, modified for plasma deaths
Returns:
bool
: True if plasma death effects were triggered, false otherwise
public override void CreateGibEffects(DamageType damageType, float xI, float yI)
Creates appropriate visual effects when the character is gibbed based on damage type. Crush damage creates a spread pattern, OutOfBounds uses larger spread, and BittenBySandworm creates directional effects. Generates frozen particles if the character was frozen, plays gib sounds, and sprays blood effects.
Parameters:
- DamageType damageType: Type of damage determining the gib effect pattern
- float xI: Base horizontal velocity for effects
- float yI: Base vertical velocity for effects
protected virtual void CreateGibs(float xI, float yI)
Default gib creation method that generates standard gib pieces with velocity. Uses the character's material for gib textures and applies an upward bias to gib velocity for more dramatic effect.
Parameters:
- float xI: Horizontal velocity for gib pieces
- float yI: Vertical velocity for gib pieces
public override void Damage(int damage, DamageType damageType, float xI, float yI, int direction, MonoBehaviour damageSender, float hitX, float hitY)
Core damage handling method that processes all incoming damage to the character. Handles special cases like inseminator unit redirection, parachute destruction (grants 1.33s invulnerability), instant-gib damage types, acid coverage, skeleton creation, and damage reduction based on game mode. Creates appropriate visual effects (blood, impact effects) and manages death state including revival mechanics. Triggers death sequence if health drops below zero.
Parameters:
- int damage: Amount of damage to apply
- DamageType damageType: Type of damage being applied (affects reactions and effects)
- float xI: Horizontal impulse force from damage
- float yI: Vertical impulse force from damage
- int direction: Direction of incoming damage (-1 left, 1 right)
- MonoBehaviour damageSender: The MonoBehaviour that caused the damage (for kill tracking)
- float hitX: X coordinate where damage was applied
- float hitY: Y coordinate where damage was applied
protected virtual void DealWithBounce(ref DamageType damageType, ref int damage)
Handles bounce damage differently based on whether the unit is a player or enemy. For players in non-competitive modes, nullifies all damage and applies a 0.25 second blind effect instead. For enemies or players in DeathMatch/BroDown modes, changes the damage type to Crush.
Parameters:
- out DamageType damageType: Reference to the damage type, may be changed to Crush
- out int damage: Reference to the damage amount, set to 0 for players in non-competitive modes
public override void Death(float xI, float yI, DamageObject damage)
Handles the complete character death sequence. Cancels active melee attacks, deactivates parachute, stops network syncing, clears revival sources, stops player UI bubbles, reports kills for scoring, reduces lives if applicable, applies death velocity modifications, deactivates weapons, creates blood effects, releases held objects, disables collision, and saves death GIFs for player characters. This is the main death orchestration method.
Parameters:
- float xI: Horizontal velocity to apply on death
- float yI: Vertical velocity to apply on death
- DamageObject damage: DamageObject containing information about what killed the character
protected virtual void DestroyRemoteProjectile()
Destroys a remotely controlled projectile. Clears controlling flag and calls Death() on the projectile.
protected virtual void FallDamage(float yI)
Virtual method for handling fall damage based on fall velocity. Empty implementation for subclasses to calculate and apply fall damage.
Parameters:
- float yI: The vertical velocity at impact
protected virtual void FindNearbyMook()
Searches for a nearby mook that can be interacted with. Prioritizes skinned mook on the player's back, otherwise searches for mooks within 30 unit radius behind the player.
protected virtual void FireWeapon(float x, float y, float xSpeed, float ySpeed)
Fires weapon projectile at specified position and velocity. Sets gun animation frame, creates muzzle flash, spawns projectile, and triggers fire events.
Parameters:
- float x: X position for projectile spawn
- float y: Y position for projectile spawn
- float xSpeed: X velocity for projectile
- float ySpeed: Y velocity for projectile
protected override void Gib(DamageType damageType, float xI, float yI)
Destroys the character into gibs (gore pieces) if gibbing is allowed. Releases held objects, sets appropriate death type, creates gib visual effects, sends network RPC to synchronize gibbing, saves death GIFs for heroes, handles special plasma death effects, and disconnects any attached face huggers.
Parameters:
- DamageType damageType: Type of damage that caused the gibbing
- float xI: Horizontal velocity for gib pieces
- float yI: Vertical velocity for gib pieces
protected void GibRPC(DamageType damageType, float xI, float yI, float _x, float _y)
Network RPC handler for synchronizing gibbing across all connected players. Updates the character position for out-of-bounds deaths and calls the local Gib method to ensure consistent visual effects across the network.
Parameters:
- DamageType damageType: Type of damage that caused the gibbing
- float xI: Horizontal velocity for gib pieces
- float yI: Vertical velocity for gib pieces
- float _x: X position for out-of-bounds gibbing
- float _y: Y position for out-of-bounds gibbing
protected virtual bool IsLockedInMelee()
Checks if character is locked in melee animation. Used to prevent other actions during melee attacks.
Returns:
bool
: True if doing melee and cannot do independent animations, false otherwise
public override void Knock(DamageType damageType, float xI, float yI, bool forceTumble)
Applies knockback force to the character from damage or explosions. Clears any impalement state and ignores knockback if frozen. Applies half the horizontal knockback force and uses different vertical limits for heroes (300) versus enemies (400). Automatically deactivates parachute if knocked upward.
Parameters:
- DamageType damageType: Type of damage causing the knockback
- float xI: Horizontal knockback force (half is applied)
- float yI: Vertical knockback force
- bool forceTumble: Whether to force the character into a tumbling state (currently unused)
public override void KnockSimple(DamageObject damageObject)
Simplified knockback method using a DamageObject for consistent force application. Ignores knockback if frozen and applies blast forces with the same velocity clamping as SetVelocity method.
Parameters:
- DamageObject damageObject: DamageObject containing knockback force information
public void ReleaseAlien(Mook newAlien, float xI, float yI, bool onFire, int seenPlayer)
RPC method that handles alien release from chest bursting. Applies fire damage to spawned alien if specified.
Parameters:
- Mook newAlien: The alien unit being released
- float xI: X velocity for alien spawn
- float yI: Y velocity for alien spawn
- bool onFire: Whether the alien should be set on fire
- int seenPlayer: Index of player that witnessed the spawn
protected void ReleaseGrenadeRPC(Grenade GrenadeToRelease, float XI, float YI, float X, float Y)
RPC method for releasing grenades across network. Handles grenade physics and positioning.
Parameters:
- Grenade GrenadeToRelease: Grenade object to release
- float XI: X velocity for grenade
- float YI: Y velocity for grenade
- float X: X position for grenade release
- float Y: Y position for grenade release
protected void ReleaseHeldObject(bool thrown)
Releases currently held object (grenade or mook) with appropriate physics and networking. Handles both throwing and dropping scenarios.
Parameters:
- bool thrown: Whether object is being thrown (true) or dropped (false)
protected virtual void RunFiring()
Main firing logic update that manages fire rate, delays, and weapon usage. Stops rolling when firing, handles fire counter and rate modifications, triggers the UseFire method, applies avatar effects, and clears gesture animations during combat.
protected virtual void RunIndependentMeleeFrames()
Virtual method for handling melee animation frames independently from main animation. Allows subclasses to implement custom melee animation logic.
protected virtual void RunKnifeMeleeMovement()
Handles movement physics during knife melee attacks with three distinct patterns. Old system applies simple gravity. Jumping melee applies falling gravity with speed clamping. Dashing melee uses frame-based movement: frames 0-1 stop movement, frames 2-3 dash horizontally (with target tracking if available), frames 4-5 reduce speed, frames 6+ apply only gravity. Quicksand disables horizontal movement.
protected virtual void RunMelee()
Executes melee attack behavior by delegating to RunKnifeMeleeMovement. Acts as the entry point for melee execution.
protected virtual void SetMeleeType()
Determines the type of melee attack (standing, jumping, or dashing) based on current character state. When using new knifing frames, checks if jumping, moving horizontally, or on ladder to set appropriate melee type.
protected virtual void SetupThrownMookVelocity(out float XI, out float YI)
Calculates output velocity for thrown mook objects. Sets X velocity to 210 units in facing direction plus 20% of current momentum, and Y velocity to 120 units upward plus 30% of current vertical momentum.
Parameters:
- out float XI: Output X velocity for thrown mook
- out float YI: Output Y velocity for thrown mook
public override void SetVelocity(DamageType damageType, float xI, float xIBlast, float yIBlast)
Sets character velocity from damage or explosion forces, adding to existing velocity rather than replacing it. Clamps horizontal velocity to ±200 and vertical velocity between -20000 and 300 to prevent excessive speeds.
Parameters:
- DamageType damageType: Type of damage causing the velocity change
- float xI: Horizontal velocity to add
- float xIBlast: Additional horizontal blast force (currently same as xI)
- float yIBlast: Vertical blast force to add
protected virtual Projectile SpawnPrimaryProjectile(Projectile projectilePrefab, float x, float y, float xSpeed, float ySpeed)
Spawns primary weapon projectile using the ProjectileController system with specified parameters.
Parameters:
- Projectile projectilePrefab: Projectile prefab to spawn
- float x: X position for projectile spawn
- float y: Y position for projectile spawn
- float xSpeed: X velocity for projectile
- float ySpeed: Y velocity for projectile
Returns:
Projectile
: Spawned Projectile instance
protected virtual void StartFiring()
Initiates firing with rate control. Sets the fire counter based on fire rate: uses fireRate value for fast firing (rate < 0.3f) or 0 for slower rates.
protected virtual void StartMelee()
Virtual method for initiating melee attacks. Empty implementation serves as an override point for subclasses to implement melee attack logic.
protected virtual void StopFiring()
Virtual method placeholder for stopping fire action. Empty in base class, allows subclasses to implement fire stopping behavior.
protected virtual void ThrowBackGrenade(Grenade grenade)
Picks up and prepares to throw a grenade. Disables the grenade, parents it to the player, handles achievement tracking for player-thrown grenades, plays throw sound, and initiates throwing animation.
Parameters:
- Grenade grenade: The grenade object to pick up and throw
protected virtual void ThrowBackMook(Mook mook)
Picks up and prepares to throw a mook enemy. Sets the mook as being thrown, parents it to the player, plays heavy throw sound, and starts throwing animation with appropriate frame.
Parameters:
- Mook mook: The mook object to pick up and throw
protected void ThrowGrenade(Grenade GrenadeToThrow, float XI, float YI, float X, float Y)
Executes grenade throwing mechanics with specified position and velocity parameters.
Parameters:
- Grenade GrenadeToThrow: Grenade object to throw
- float XI: X velocity for grenade trajectory
- float YI: Y velocity for grenade trajectory
- float X: X position for grenade release
- float Y: Y position for grenade release
protected virtual void TriggerBroFireEvent()
Triggers perk system fire event for hero characters to activate fire-related perks and bonuses.
protected virtual void TriggerBroMeleeEvent()
Triggers perk system melee event for hero characters to activate melee-related perks and bonuses.
protected virtual void TriggerBroSpecialEvent()
Triggers perk system special ability event for hero characters to activate special-related perks and bonuses.
protected virtual void UseFire()
Executes primary weapon firing sequence. Cancels melee if active, calculates projectile trajectory, spawns projectile, plays attack sound, and disturbs wildlife.
Fields
protected float _invulnerableTime
Remaining duration of invulnerability in seconds. Decremented each frame, providing temporary damage immunity. Commonly set after spawning (3 seconds) or parachute destruction (1.33 seconds). Visual feedback provided through flashing effect.
protected bool addedDeathMatchScore
Flag preventing duplicate score additions in deathmatch game modes. Set to true after death score is recorded to ensure each death only counts once. Reset when the unit respawns for the next life.
protected bool cancelMeleeOnChangeDirection
Stops melee attack when the character changes facing direction. Used by characters with directional melee attacks to ensure attacks match the intended direction.
public bool canDoIndependentMeleeAnimation
Allows melee animations to play independently from movement animations. When true, melee attacks don't interrupt movement animations. Used by characters like IndianaBrones.
public bool canGib = true
Determines if this character can be gibbed (exploded into pieces) when killed. Default true allows normal gibbing on death. Set to false for characters that should have death animations instead of exploding. Checked during death processing.
protected bool dashingMelee
Indicates the character is performing a melee attack while dashing. Set by SetMeleeType() when dashing, triggers special dash-melee animations and damage values.
protected float deadTimeCounter
Timer tracking how long the unit has been dead. Incremented each frame after death. Used for delayed effects like late gibbing, corpse removal, or preventing revival after extended death duration.
protected int disembowelHoldFrames
Frame counter for chainsaw disembowelment death animation. When greater than zero, holds the death animation at the current frame to show prolonged chainsaw damage. Creates dramatic pause during brutal chainsaw deaths.
protected bool doingMelee
Indicates the character is currently performing a melee attack. Affects animation states and prevents certain other actions while active. Cleared when the melee attack completes.
protected float fireCounter = 0.0667f
Accumulates time to control automatic firing rate. When this counter exceeds fireRate, a shot is fired and the counter is decremented by fireRate. Initialized to 0.0667 to ensure immediate first shot capability.
public float fireDelay
Delay in seconds before firing can begin. Prevents immediate firing in certain situations such as after spawning or switching weapons.
protected bool firedWhileInvulnerable
Tracks if the player fired weapons during invulnerability period. When true, immediately cancels invulnerability as a penalty for aggressive play during spawn protection. Encourages defensive play after respawning.
public float fireRate = 0.0334f
Time interval between automatic weapon shots in seconds. Default value of 0.0334 provides approximately 30 shots per second. Can be modified by power-ups through ValueOrchestrator.
public GibHolder gibs
Reference to the GibHolder containing gore particle prefabs for this character. Used when the unit is gibbed to spawn appropriate blood and body part effects. Each character can have unique gib sets for visual variety.
protected int gibThreshold = -10
Health threshold below which the unit will gib instead of playing death animation (default -10). When health drops below this value from damage, the unit explodes into pieces. More negative values require more overkill damage to trigger gibbing.
protected bool hasPlayedMissSound
Prevents multiple miss sound effects from playing for a single melee attack. Reset when canceling melee or starting a new attack.
protected int heroThatKilledMeIndex = -1
Player index of the hero that killed this unit (default -1 for no killer). Used for respawn positioning to place the unit near their killer. Also used for kill attribution in statistics and scoring systems.
protected Vector3 iDiedAtPosition = Vector3.zero
World position where this unit died (default Vector3.zero). Stored for respawn calculations and death statistics. Used with heroThatKilledMeIndex to determine optimal respawn location near the action.
protected bool impaledByChainSaw
Flag indicating the unit was killed by chainsaw impalement. Currently not actively used in the codebase. May have been intended for special chainsaw death animations or to prevent certain post-death effects.
public GameObject impalementCollider
GameObject reference to the collider used for impalement mechanics. Destroyed when cleanup is needed to prevent physics conflicts. Handles collision detection for impalement death scenarios.
protected bool jumpingMelee
Indicates the character is performing a melee attack while jumping or airborne. Set by SetMeleeType() based on action state, determines aerial melee animations and physics.
protected float lastAlertTime
Tracks when the character last alerted nearby enemies. Prevents alert spam with minimum 0.07 seconds between alerts. Only alerts when character is alive and not in stealth mode.
protected Unit meleeChosenUnit
Stores the target unit for melee attacks. Set when a valid melee target is found nearby and used to calculate movement toward the target during the melee animation.
protected bool meleeFollowUp
Indicates whether a melee combo or follow-up attack is allowed. Set to false in CancelMelee(), checked with dashingMelee to control combo behavior.
protected bool meleeHasHit
Tracks whether the current melee attack has successfully connected with a target. Prevents multiple damage applications from a single melee attack.
protected float projectileTime
Cooldown timer preventing immediate detonation of remote projectiles after firing. Set to 0.3 seconds when firing remote explosives. Prevents accidental self-destruction by requiring a brief delay before detonation is allowed.
public RemoteControlExplosiveCar remoteCar
Reference to a remote control car currently being controlled by this character. When set, player input controls the car instead of the character. Provides reference for remote vehicle mechanics. Cleared when car is destroyed or control ends.
public Projectile remoteProjectile
Reference to a projectile currently under remote control by this character. When set, character can detonate or guide the projectile. Cleared when projectile is destroyed or control is released. Used for remote-controlled explosives gameplay.
public SkinnedMook skinnedMookOnMyBack
Reference to a SkinnedMook enemy that has jumped onto this unit's back. When set, reduces movement speed by 50%, prevents dashing and wall climbing, and marks the unit as having "baggage". The attached enemy can be removed by melee attacks or death.
protected float specialCounter = 0.0667f
Controls timing for special ability usage. Similar to fireCounter but for special attacks. Initialized to 0.0667 seconds.
protected bool standingMelee
Indicates the character is performing a melee attack while standing or grounded. Set by SetMeleeType() based on action state, determines ground melee animations.
public bool willComeBackToLife
Indicates this unit will resurrect after death. When true, displays a halo effect above the corpse and prevents certain death cleanup operations. The resurrection occurs after willComebackToLifeTime expires.
protected float willComebackToLifeTime
Countdown timer in seconds until resurrection occurs. Set when unit dies with willComeBackToLife active. Decremented each frame while dead, triggering resurrection and full health restoration when reaching zero.
Special Abilities
Methods
public virtual void AddSpecialAmmo()
Increases special ammunition by 1 if below maximum capacity and updates the HeroController with the new value.
protected virtual void Airdash(bool highFived)
Main air dash input handler that checks directional inputs and availability, then calls the appropriate directional dash method. Processes dashes in priority order: Right, Left, Down, Up.
Parameters:
- bool highFived: If true, allows horizontal dashes without requiring fresh directional input.
protected virtual void AirDashDown()
Initiates a downward slam air dash with an extended duration (5x normal), starting with a slight upward movement before transitioning to a powerful downward motion.
protected virtual void AirDashLeft()
Initiates a leftward air dash with a two-phase execution: a charge-up delay followed by the actual dash. The dash grants brief invulnerability and enables downward dashing afterwards.
protected virtual void AirDashRight()
Initiates a rightward air dash with a two-phase execution: a charge-up delay followed by the actual dash. The dash grants brief invulnerability and enables downward dashing afterwards.
protected virtual void AirDashUp()
Performs an instant upward air dash without charge-up delay, launching the character upward with 150% jump force for a shorter duration than horizontal dashes.
protected virtual bool CanUseJetpack()
Checks if the hero can use jetpack abilities. Base implementation returns false, override for jetpack-enabled heroes.
Returns:
bool
: True if jetpack can be used
internal void GetRemoteControlCar()
Creates and assigns a remote control car to this unit. Only executes for the owning player, sets up networking RPCs for control. Applies initial knockback and sets fire delay to prevent immediate use.
public override int GetSpecialAmmo()
Gets the current special ammunition count for this character.
Returns:
int
: Current special ammunition amount
public virtual bool IsAmmoFull()
Checks if special ammunition is at maximum capacity compared to the original special ammo limit.
Returns:
bool
: True if ammunition is at maximum, false otherwise
protected virtual bool MustUsePockettedSpecialAmmo()
Checks if pocketed special ammo must be used. Base implementation returns false, designed for override by characters with special ammo requirements.
Returns:
bool
: False in base implementation, can be overridden to return true when special ammo must be used
public virtual void PickupPockettableAmmo(PockettedSpecialAmmoType ammoType)
Handles picking up pocketable special ammunition. Virtual method intended for override by specific character implementations.
Parameters:
- PockettedSpecialAmmoType ammoType: Type of pocketable ammo being picked up
protected virtual void PlayAidDashSound()
Virtual method for playing the air dash execution sound effect. Empty in base class, intended for override in derived classes. Note: Method name contains typo ("Aid" instead of "Air").
protected virtual void PlayAirDashChargeUpSound()
Virtual method for playing the air dash charge-up sound effect. Empty in base class, intended for override in derived classes.
public virtual void ResetSpecialAmmo()
Resets special ammunition to the original maximum amount and updates the HeroController with the new value.
protected virtual void RunAirDashing()
Central air dash controller that manages dash execution based on direction. Delegates to specific directional dash methods, counts down dash timer, and clamps velocities to normal ranges when dash completes. Special handling for upward dashes limits velocity to 80% jump force.
protected virtual void RunDownwardDash()
Executes downward slam dash with accelerating descent. Uses complex velocity calculation that accelerates downward movement, triggers sound and visual effects when reaching -50 velocity threshold, and clamps final velocity between 1.25x max fall speed and 300 units.
protected virtual void RunLeftAirDash()
Executes leftward air dash with two-phase implementation. Delay phase: stops vertical movement and adds slight rightward anticipation movement. Dash phase: triggers animation change, plays dash sound, creates rightward poof effect, and calls SetAirDashLeftSpeed.
protected virtual void RunRightAirDash()
Executes rightward air dash with two-phase implementation. Delay phase: stops vertical movement and adds slight leftward anticipation movement. Dash phase: triggers animation change, plays dash sound, creates leftward poof effect, and calls SetAirDashRightSpeed.
protected virtual void RunUpwardDash()
Executes upward air dash immediately without delay phase. Resets jump timer, applies 150% jump force for strong upward boost, and zeroes horizontal movement.
protected void SetAirdashAvailable()
Resets all directional air dash availability flags to true, allowing the character to perform air dashes in all directions again.
protected virtual void SetAirDashLeftSpeed()
Sets velocity for leftward air dash execution. Zeroes vertical movement and sets horizontal velocity to -2.3x normal speed for fast leftward movement.
protected virtual void SetAirDashRightSpeed()
Sets velocity for rightward air dash execution. Zeroes vertical movement and sets horizontal velocity to 2.3x normal speed for fast rightward movement.
protected virtual void SetHeldObjectPos(float xOffset, float yOffset)
Positions held objects (grenades/mooks) relative to character with specified offset coordinates.
Parameters:
- float xOffset: X offset from character position
- float yOffset: Y offset from character position
public virtual void SetRemoteProjectile(Projectile p)
Associates a remote-controlled projectile with this unit. Updates projectile time tracking and stores the projectile reference.
Parameters:
- Projectile p: The projectile to be remotely controlled
public void SetSpecialAmmoRPC(int ammo)
Sets special ammunition amount via RPC for network synchronization and updates the HeroController.
Parameters:
- int ammo: Amount of special ammunition to set
protected virtual void StartPockettedSpecial()
Virtual method for initiating pocketed special ability. Empty in base class, designed for character-specific overrides to implement special weapon usage.
protected virtual void UseJetpack()
Activates jetpack thrust for vertical movement. Virtual method intended for override by jetpack-equipped heroes.
protected virtual void UsePockettedSpecial()
Virtual method for using pocketed special abilities. Resets facing direction and can be overridden by derived classes.
protected virtual void UseSpecial()
Uses special ability (grenade throwing). Consumes special ammo, spawns grenade projectile with position-based trajectory, or flashes ammo indicator if depleted.
public virtual void UseSteroidsNetworked()
Activates steroid power-up effects across the network. Virtual method intended for override by heroes with steroid abilities.
public virtual void UseSteroidsNetworkedForDuration(float duration)
Activates steroid power-up effects for a specific duration across the network. Virtual method intended for override by heroes with timed steroid abilities.
Parameters:
- float duration: Duration of the steroid effect in seconds
Properties
public virtual int SpecialAmmo { get; set; }
Gets or sets the current special ammunition count. Setting this property synchronizes the value across all clients when the unit is owned by the local player.
Fields
protected int _specialAmmo
Current special ammunition count (backing field for SpecialAmmo property). Changes to this value are synchronized across the network via RPC calls.
public int originalSpecialAmmo = 3
Default and maximum special ammunition capacity. Typically set to 3 but can be overridden (e.g., 6 for certain game modes). Used to initialize special ammo on spawn and check if ammo is full.
protected int pressSpecialFacingDirection
Stores the character's facing direction when a special ability is activated. Used to lock facing direction during special abilities when turnAroundWhhileUsingSpecials is false. Reset when actions complete.
public Grenade specialGrenade
Reference to the grenade prefab spawned when using special abilities. Different throwing trajectories are used based on whether the character is ducking or standing.
public bool turnAroundWhhileUsingSpecials = true
Controls whether the character can change facing direction while using special abilities. When false, the character's facing is locked to the direction they were facing when the special was activated. Defaults to true.
protected bool usingPockettedSpecial
Indicates the character is using a stored or pocketed special ability. Often set and cleared together with the main usingSpecial flag and affects animation states.
protected bool usingSpecial
Indicates the character is currently performing a special ability animation. Set true when special is pressed, false when animation completes or is interrupted by acid/remote control. Takes priority in animation selection.
protected bool usingSpecial2
Secondary special ability input state, primarily used by AI enemies. Checked as part of the IsUsingSpecial condition for determining if any special ability is active.
protected bool usingSpecial3
Tertiary special ability input state, primarily used by AI enemies. Part of the multi-special ability system that allows AI to have different special attacks.
protected bool usingSpecial4
Quaternary special ability input state, primarily used by AI enemies. Provides a fourth special ability option for complex AI behavior patterns.
protected bool wasUsingSpecial
Previous frame's primary special ability state. Used for edge detection to determine when special abilities are first activated.
protected bool wasUsingSpecial2
Previous frame's secondary special ability state. Used for edge detection of AI special ability inputs.
protected bool wasUsingSpecial3
Previous frame's tertiary special ability state. Used for edge detection of AI special ability inputs.
protected bool wasUsingSpecial4
Previous frame's quaternary special ability state. Used for edge detection to trigger AI special abilities on button press.
Position & Physics
Methods
protected virtual void AddParentedDiff(float xDiff, float yDiff)
Adds positional differences to the character's coordinates based on parent movement, with special handling for different parent types.
Parameters:
- float xDiff: The horizontal position difference to apply.
- float yDiff: The vertical position difference to apply.
protected virtual void AddSpeedLeft()
Accelerates the character leftward with speed limits and multipliers based on movement state. Base acceleration is 2x, dashing provides 4x, and parachute reduces speed by 50%. Includes an extra 2.6x boost when below maximum speed.
protected virtual void AddSpeedRight()
Accelerates the character rightward with speed limits and multipliers based on movement state. Base acceleration is 2x, dashing provides 4x, and parachute reduces speed by 50%. Includes an extra 2.6x boost when below maximum speed.
protected virtual void AirJump()
Virtual method placeholder for air jump/double jump mechanics. Empty in base class, allows subclasses to implement air jumping behavior.
protected virtual void ApplyFallingGravity()
Orchestrates gravity application based on character state, delegating to specialized gravity methods for parachute, quicksand, or normal conditions.
protected virtual void ApplyNormalGravity()
Applies standard gravity with modifiers for fluid submersion and high-five boost effects.
protected virtual void ApplyQuicksandGravity()
Applies special gravity behavior in quicksand, clamping velocities and creating a floating effect with different sink rates for alive versus dead characters.
protected void AssignGroundTransform(Transform gTransform)
Assigns and tracks the transform of the ground or platform the character is standing on. Stores local position offset for proper movement synchronization with moving platforms. Handles special notifications for blocks when being stood on.
Parameters:
- Transform gTransform: The ground transform to assign as the current standing surface
protected void AssignParentedPos()
Stores the current position relative to the parent transform for tracking movement between frames.
protected virtual void AssignWallTransform(Transform wTransform)
Assigns the wall transform for wall climbing mechanics. Stores the wall reference and calculates the character's local position relative to the wall for proper climbing movement.
Parameters:
- Transform wTransform: The wall transform to assign for climbing
public override void AttachToZipline(ZipLine zipLine)
Attaches character to zipline for transportation. Sets zipline state and disables normal movement controls.
Parameters:
- ZipLine zipLine: ZipLine object to attach to
internal void CalculateCollumnRowFromTransform()
Updates the unit's grid position based on its transform position. Sets X and Y from transform and recalculates grid coordinates.
private void CalculateGridPosition()
Converts world position to grid coordinates for tile-based game mechanics. Updates the character's row and column values based on 16-unit grid size.
public virtual void CalculateGroundHeight()
Updates the ground height for the character by calling GetGroundHeightGround to perform ground detection calculations.
protected virtual void CalculateMovement()
Core movement calculation method that processes all character input and physics. Handles wind effects, sandstorm damage, firing input, dash detection, directional movement with double-tap dash triggers, air dashes during high-five holds, action state transitions, edge slip prevention, down input processing with parachute deactivation, and comprehensive jump mechanics including wall jumps, quicksand jumps, wall climbing initiation, and air jump grace periods.
protected virtual bool CanAirDash(DirectionEnum direction)
Determines if character can perform air dash in specified direction based on character state and directional availability. Returns true if character can air dash or is on ground, false if dead, acid-covered, or direction unavailable.
Parameters:
- DirectionEnum direction: Direction to check for air dash availability (Up, Down, Left, Right)
Returns:
bool
: True if air dash is possible in the specified direction, false otherwise
protected virtual bool CanBeAffectedByWind()
Determines if character can be affected by wind effects. Returns false during chimney flip to prevent wind interference with the maneuver.
Returns:
bool
: True if character can be affected by wind, false during chimney flip
protected virtual bool CanJumpOffGround()
Determines if character can jump from current ground position by checking for solid ground contact with wall collision considerations. Accounts for directional movement restrictions and quicksand movement penalties.
Returns:
bool
: True if character can jump from current position, false otherwise
protected bool CanTouchGround(float xOffset)
Checks if the character can touch ground using multiple raycasts at different positions. Performs up to 4 raycasts for regular ground and 4 additional raycasts for ladders if applicable.
Parameters:
- float xOffset: Horizontal offset for additional raycast checks.
Returns:
bool
: True if any raycast hits ground or ladder, false otherwise.
protected void CheckDucking()
Advanced ducking logic that handles auto-ducking in tight spaces. Checks for ceiling and floor constraints, auto-ducks when running into low passages, and stops ducking when space becomes available.
protected virtual void ClampSpeedPressingLeft()
Clamps horizontal velocity to -10 when pressing left without simultaneous right input to ensure responsive leftward movement initiation.
protected virtual void ClampSpeedPressingRight()
Clamps horizontal velocity to 10 when pressing right without simultaneous left input to ensure responsive rightward movement initiation.
protected virtual void ClampWallDragYI(ref float yIT)
Limits vertical velocity during wall dragging to control sliding speed. Prevents upward movement and clamps minimum falling speed to -40 units.
Parameters:
- out float yIT: Reference to vertical velocity to be clamped
protected void ConstrainSpeedToSidesOfScreen()
Enforces screen boundaries to prevent the character from moving outside the playable area, with special handling for repositioning fallen players.
protected virtual void DontSlipOverEdges()
Prevents heroes from accidentally falling off edges by detecting ground ahead and stopping movement. Uses raycast detection based on facing direction to check for ground at feet width distance, stopping rolling and zeroing velocity when edge detected.
public virtual void EvaluateIsJumping()
Determines if the character should be in a jumping state by checking if they are more than 0.1 units above the ground. Only evaluates when ground height is valid (not -100000).
public virtual Vector3 GetFollowPosition()
Returns the position for the camera to follow, accounting for parachute state. During parachute deployment, returns a position with temporary Y value to smooth camera movement.
Returns:
Vector3
: The world position the camera should follow
public virtual float GetGroundHeightGround()
Calculates the ground height below the character using box casts and raycasts. Checks for both regular ground and ladders, updating ground references and footstep sound types based on what is detected.
Returns:
float
: The highest ground point found, or -200f if no ground is detected.
public virtual LayerMask GetGroundLayer()
Returns the appropriate layer mask for ground detection based on whether the player is holding down. When not holding down, includes platforms; when holding down, excludes platforms to allow dropping through.
Returns:
LayerMask
: LayerMask combining ground, fragile, and optionally platform layers.
protected Vector3 GetParentedToPos()
Calculates the character's position relative to their parent transform, used for maintaining relative positioning on moving platforms.
Returns:
Vector3
: The character's position in parent transform space, or world position if not parented.
public Transform GetParentedToTransform()
Returns the current parent transform in order of priority: impaled transform, wall climb transform, or ground transform.
Returns:
Transform
: The active parent transform, or null if not parented to anything.
protected virtual void HitLeftWall()
Virtual method called when character collides with left wall. Empty implementation that can be overridden by derived classes for wall collision handling.
protected virtual void HitRightWall()
Virtual method called when character collides with right wall. Empty implementation that can be overridden by derived classes for wall collision handling.
protected bool IsGroundBelow(float maxDistance)
Simple ground detection with fixed 5-unit range using two raycasts from left and right foot positions.
Returns:
bool
: True if either foot detects ground within 5 units below.
protected bool IsGroundBelow(float maxDistance)
Parameterized ground detection with variable range using two raycasts from foot positions.
Parameters:
- float maxDistance: Maximum distance to check for ground below the character.
Returns:
bool
: True if either foot detects ground within the specified distance.
protected bool IsGroundBelowAtXOffset(float xOffset, bool includeLadders)
Ground detection at a specific horizontal offset from the character position, useful for checking ground ahead or behind.
Parameters:
- float xOffset: Horizontal offset from character position to check.
- bool includeLadders: Whether to include ladder detection in addition to ground.
Returns:
bool
: True if ground (and optionally ladders) detected at the offset position.
public override bool IsNearGround(float maxOffset)
Checks if the character is within a specified distance from the ground.
Parameters:
- float maxOffset: Maximum distance above ground to consider "near".
Returns:
bool
: True if the character's Y position is below ground height plus the offset.
protected bool IsOilyBelow()
Detects if there are oily surfaces beneath the character using two raycasts from foot positions. Checks 9 units down from Y+4 position with foot spread of 4 units.
Returns:
bool
: True if either foot position detects an oily block below.
public override bool IsOnGround()
Determines if the character is standing on ground by checking if Y position is within 0.5 units above ground height and vertical velocity is not positive.
Returns:
bool
: True if the character is on ground, false otherwise.
protected bool IsWallInFront(float distance)
Detects if there's a wall in front of the character at waist height using raycasting. Used for wall detection in movement and climbing systems.
Parameters:
- float distance: The distance to check for walls
Returns:
bool
: True if a wall is detected within the specified distance
protected bool IsWallInFrontOfHead(float distance)
Detects if there's a wall at head height (Y position + 17 units) using raycasting. Used to prevent movement into walls at head level.
Parameters:
- float distance: The distance to check for walls
Returns:
bool
: True if a wall is detected at head height within the specified distance
protected virtual void Jump(bool wallJump)
Handles all jump mechanics including wall jumps, grace jumping, and special surface interactions. Adjusts jump force based on surface type (barbed wire reduces to 80%, bouncy blocks increase to 190%) and inherits velocity from moving platforms.
Parameters:
- bool wallJump: If true, performs a wall jump with horizontal velocity reset and climb sound/animation.
protected virtual void NotPressingJump()
Processes jump button release by disabling wall climbing state when jump is not being pressed.
public override void OpenParachute()
Activates the parachute if not already active. Sets the IsParachuteActive flag to true.
public virtual void ParachuteLandedOn()
Called when another object lands on this unit's parachute. Virtual method intended for override by specific implementations.
protected virtual void PressDown()
Handles down button press input by recording the tap time for potential down-based actions.
private bool RaycastGroundSingleSquare(Vector3 direction)
Helper method that performs a single raycast for ground detection. Casts from 8 units above character position with 12 unit ray length.
Parameters:
- Vector3 direction: The direction to cast the ray (typically Vector3.down)
Returns:
bool
: True if ground is detected within range, false otherwise
public void ResetToOriginalJumpForce()
Restores the original jump force and clears the attack jump force timer if previously modified.
protected virtual void RunAirFriction()
Virtual method placeholder for air friction. Empty in base class, allows subclasses to implement air resistance.
protected virtual bool RunCheckHanging()
Detects if character can hang from ceiling using upward raycasts. Requires 0.8 seconds after jump, appropriate directional conditions, and ceiling detection within range. Sets vertical velocity based on ceiling distance and tracks interactive ceiling objects.
Returns:
bool
: True if hanging conditions are met and ceiling is detected.
protected virtual void RunDeadGravity()
Applies physics when character is dead. In air: applies gravity or quicksand gravity unless impaled, triggers falling animation at -50 velocity. On ground: applies friction using 10x friction multiplier.
protected virtual void RunFallen()
Virtual method placeholder for post-fall state behavior. Empty in base class, allows subclasses to implement custom fallen state logic.
protected virtual void RunFalling()
Virtual method placeholder for falling state behavior. Empty in base class, allows subclasses to implement custom falling logic.
protected virtual void RunGroundFriction()
Applies friction when character is on ground and idle. Normal friction rapidly decelerates at 25x rate, while rolling friction is slower at 5x rate.
protected virtual void RunHanging()
Manages movement and physics while hanging from ceiling. Provides slight upward movement with up/jump input, applies horizontal speed clamping based on animation frame, increases friction when not moving, and continuously checks for ceiling presence. Automatically stops hanging when ceiling is lost or down is pressed.
protected virtual void RunImpaledMovement()
Handles movement constraints when the character is impaled by an object. Checks if the impaling object still exists, manages blood effects, and evaluates if the character should remain in the impaled state.
protected virtual void RunMovement()
Central movement processing hub that orchestrates all character movement based on action state. Handles dead state physics with quicksand damping, ladder and zipline mechanics, jump timing and gravity application, water physics damping, comprehensive collision detection for walls/ceilings/floors, out-of-bounds death triggers, and frame-based movement calculations. This is the core method that drives all character physics and movement.
protected virtual void RunStrungByPredabroMovement()
Handles special movement when the character is caught by a Predabro enemy. Positions the character below the predabro with a -24 Y offset (additional -5 for MookBigGuy) and zeros out velocity while caught.
protected virtual void SetActionstateToIdle()
Sets the character's action state to idle. Simple state transition method that can be overridden by derived classes.
protected virtual void SetActionStateToJumping(bool forced = false)
Changes the character's action state to jumping with health validation. Normal mode requires positive health and not already jumping. Updates animation frame unless using special ability.
Parameters:
- bool forced: If true, bypasses the check for already being in jump state (but still requires health > 0).
public override void SetCanParachute(bool canParachute)
Enables or disables parachute capability with appropriate delay setup. When enabling, stores camera Y position and sets delay (0.15s for players, 0.6s for NPCs). When disabling, deactivates the parachute.
Parameters:
- bool canParachute: Whether parachute use is allowed
public void SetParachuteDelay(float time)
Sets the delay before the parachute can be deployed. Used to prevent immediate parachute use after certain actions.
Parameters:
- float time: Delay in seconds before parachute can be used
public override void SetPositionAndVelocity(float newX, float newY, float xi, float yi)
Sets the position and velocity of TestVanDammeAnim with teleportation handling. If the distance change exceeds 6 units, directly sets position to prevent large jumps.
Parameters:
- float newX: New X coordinate position
- float newY: New Y coordinate position
- float xi: X velocity component
- float yi: Y velocity component
protected void ShiftUnitWithParent()
Updates the character's position based on parent transform movement, applying the difference between frames.
protected virtual void StartDucking()
Initiates ducking state and adjusts collision heights. Sets ducking flag, updates height values, cancels hanging state, and triggers animation update.
protected virtual void StopAirDashing()
Cancels air dash state and resets related variables. Clears chimney flip animation frames and air dash timers.
protected void StopDashing()
Manages dash speed multiplier cleanup when ending dash sequences. Resets dash speed to 1.0 for grounded characters while preserving last dash speed for airborne characters to maintain momentum.
protected void StopDucking()
Exits ducking state if conditions allow. Checks if player is still holding down while standing still and restores standing height values.
public void TeleportOnScreenCounter(int delay)
Sets a delay counter for teleporting the hero back on screen when they fall below the visible area. Used to give a grace period before forcibly bringing off-screen players back into play.
Parameters:
- int delay: Number of frames to wait before teleporting back on screen
public virtual void Tumble()
Virtual method placeholder for tumble mechanics. Empty in base class, allows subclasses to implement tumbling behavior.
public void UseAttackJumpForceForSeconds(float seconds)
Temporarily increases jump force to attack jump force for a specified duration. Stores original jump force for restoration.
Parameters:
- float seconds: Duration in seconds to use the enhanced jump force
Properties
protected virtual float GetSpeed { get; set; }
Gets the effective movement speed considering all active modifiers and environmental effects. Speed is reduced by 50% when surrounded by barbed wire.
protected virtual bool IsStandingStill { get; set; }
Gets a value indicating whether the character is completely stationary. Returns true when the character is on the ground and both X and Y velocities are below 0.5.
public virtual float jumpForce { get; set; }
Gets or sets the force applied when the character jumps. This value can be temporarily modified for special attack jumps.
public override Vector2 XY { get; set; }
Gets or sets the character's position as a Vector2. This override provides network synchronization hooks for the base class position property.
Fields
public float _jumpForce = 260f
Private backing field for the jumpForce property. Stores the base jump force value in units per second. Default value is 260.
protected float airDashDelay
Controls the delay/charge-up time before an air dash executes. Set to defaultAirdashDelay when initiating a dash and counts down during the charge phase. Provides invulnerability during the delay period.
protected DirectionEnum airdashDirection = DirectionEnum.Any
Tracks which direction the current air dash is going. Can be Right, Left, Up, Down, or Any. Affects movement physics during the dash execution.
protected bool airdashDownAvailable
Tracks if downward air dash is available. Set to true by SetAirdashAvailable and disabled after use. Downward dashes use a 5x duration multiplier for extended effect.
protected bool airdashLeftAvailable
Tracks if leftward air dash is available. Set to true by SetAirdashAvailable and disabled after use to prevent repeated air dashes until landing or wall climbing.
public float airdashMaxTime = 0.5f
Maximum duration of an air dash in seconds. Base value of 0.5 seconds is multiplied by 0.8x for upward dashes (shorter) and 5x for downward dashes (longer slam).
protected bool airdashRightAvailable
Tracks if rightward air dash is available. Set to true by SetAirdashAvailable and disabled after use to create a one-dash-per-direction aerial movement system.
protected float airdashTime
Timer controlling air dash duration and availability. Set to airdashMaxTime when initiating dash and decrements each frame. Different dash types use different multipliers (up=0.8x, down=5x).
protected bool airdashUpAvailable
Tracks if upward air dash is available. Set to true by SetAirdashAvailable and disabled after use to prevent repeated air dashes in the same direction until reset.
public float attackJumpForce
Alternative jump force used during attack moves. Applied temporarily via UseAttackJumpForceForSeconds method to create special attack jump mechanics.
private float attackJumpForceSecondsRemaining = -1f
Timer for temporary jump force modifications during special attacks. While greater than or equal to 0, overrides normal jump force with attackJumpForce. Counts down each frame and resets to -1 when expired.
protected float belowScreenCounter
Timer tracking how long unit has been below screen bottom. Incremented when Y position is 30 units below screenMinY. Triggers repositioning when exceeding 2 seconds.
public const float bouncyJumpMultiplyer = 1.9f
Multiplier constant (1.9x) intended for bouncy/spring jump mechanics. Currently defined but not actively used in TestVanDammeAnim. May be utilized by derived classes for special jump behaviors on trampolines or springs.
public bool canAirdash
Master toggle for air dash ability. When true, allows the character to perform directional air dashes. Used by characters like Nebro, BroLee, and TheBrocketeer.
public bool canCeilingHang
Allows the character to hang from ceilings. When true, enables hanging when near ceiling with up/jump input. Used by special characters like ScorpionBro.
public bool canDash = true
Master toggle for dashing ability. Default is true. When false, prevents all dash moves and affects ladder climbing behavior (cannot climb ladders while dashing).
public bool canPushBlocks = true
Controls whether the character can push moveable blocks. Default is true. Only allows pushing when running or climbing ladders. Triggers Map.PushBlock when conditions are met.
protected bool canTouchCeiling
Controls whether unit can collide with ceilings. Set by ConstrainToCeiling method and affects wall drag behavior. Protected field for internal collision state.
public bool canTouchLeftWalls
Allows or blocks collision with left walls. Public field for external collision control. Referenced in barbed wire collision checks.
public bool canTouchRightWalls
Allows or blocks collision with right walls. Public field for external collision control. Works with canTouchLeftWalls for directional collision management.
public bool canWallClimb = true
Determines if the character can climb walls. Default is true but can be disabled for certain character types. Also used by the AI pathfinding system to determine movement options.
protected float ceilingHeight = 1000f
Height of ceiling above character. Updated by upward raycast checks from center and both sides. Default value of 1000 indicates no ceiling. Used for vertical space calculations and movement constraints.
protected bool chimneyFlip
Indicates whether the player is currently performing a chimney flip wall-jump maneuver. Set to true when initiating the flip, false when animation completes or air dash stops.
protected bool chimneyFlipConstrained
Determines whether horizontal movement is restricted during a chimney flip. When true, horizontal movement is limited unless up/jump is held.
protected int chimneyFlipDirection
Horizontal direction of chimney flip (-1 for left, 1 for right). Multiplied by 100 to set horizontal velocity during the flip maneuver.
protected int chimneyFlipFrames
Animation frame counter for chimney flip, starting at 11 and counting down to 0. Used to calculate animation frame (22 - chimneyFlipFrames) and control movement restrictions.
protected bool constrainedLeft
Indicates collision with wall on left side during current frame. Set true when raycast detects left wall collision. Works with constrainedRight for full wall detection.
protected bool constrainedRight
Indicates collision with wall on right side during current frame. Set true when raycast detects right wall collision. Used for ceiling hang transitions and wall interaction mechanics.
public bool dashing
Current dash state of the character. When true, applies dash speed multiplier and triggers dash animations.
protected float dashSpeedM = 1f
Current air dash speed multiplier (default 1.0). Increased during air dashes to provide burst movement. Value changes dynamically during dash execution and returns to 1.0 when dash ends.
protected float dashTime
Timestamp marking when the current dash started. Set when initiating a dash after successful double-tap detection.
protected float defaultAirdashDelay = 0.15f
The standard delay time in seconds before air dashes execute. Default value of 0.15 seconds provides consistency across different air dash types.
protected bool delayedDashing
Handles dash continuation after landing from an aerial state. When true, allows dash to resume upon landing if conditions are met.
public JiggleDoodad doodadCurrentlyHangingFrom
Reference to the ceiling JiggleDoodad object the character is currently hanging from. Set when grabbing ceiling and used for physics interactions with environmental effects.
protected int doubleJumpsLeft
Tracks remaining double jump charges. Always reset to 0 in the base implementation when landing, wall jumping, or entering various states. Actual double jump functionality appears to be implemented in derived classes.
protected float downTapTime
Timestamp of the last down direction button press. Set in PressDown() method, potentially used for ground pound or slide mechanics.
protected float feetWidth = 4f
Width for foot collision detection in units. Default value of 4 used in ground detection raycasts. Adjusts based on movement direction for better platforming feel.
protected float frictionM = 10f
Ground friction multiplier affecting horizontal deceleration. Default value of 10. Applied as xI *= (1 - Clamp01(t * frictionM)) when on ground. Higher values create faster deceleration.
private bool graceJumping
Allows jump input buffering on bouncy blocks. Set to true when initiating jump and checked for bouncy block interactions to provide forgiving jump timing.
public const float GRAVITY = 1100f
Standard gravity constant of 1100 units/second² used for character physics. Note: While defined as a constant, the codebase often uses the literal value 1100f instead of referencing this constant. Represents downward acceleration for all characters.
public const float gravityWaterDanmping = 0.5f
Unused constant intended for water gravity damping (0.5f). Currently not referenced in the codebase. The actual water damping is handled by separate waterDampingX (0.95f) and waterDampingY (0.65f) fields.
public float groundHeight
Current ground level below character. Updated by CalculateGroundHeight each frame. Core vertical reference point used for ground detection, fall damage calculations, and jumping mechanics.
protected float halfWidth = 6f
Half of unit's collision width in units. Default value of 6 used throughout for wall collision boundaries, ledge detection, and constraint calculations. Returned by HalfWidth property.
protected float hangGrace
Grace period timer that allows the player to grab onto ceilings within a short window after moving away from a climbable surface. Initialized to hangGraceTime (0.3f) when near ceilings while jumping. Counts down each frame.
protected float hangGraceTime = 0.3f
Grace period for hanging mechanics in seconds. Default value of 0.3 sets hangGrace timer when detecting hang points. Multiplied by 1.33x for upward hangs.
protected bool hasDashedInAir
Tracks whether the player has already performed a dash while airborne in the current jump. Prevents multiple air dashes until landing, reset to false upon touching ground.
public float JUMP_TIME = 0.123f
Duration in seconds that jump force is applied when the jump button is held. Default 0.123 seconds allows for variable jump heights. Used to calculate upward velocity during jumps. Can be modified per-character for different jump behaviors.
protected float jumpTime
Multi-purpose timer for jump-related mechanics. Set to 0.13 seconds at the start of a standard jump and controls jump boost duration. Also prevents wall climbing immediately after jumping. Different jump types use values between 0.03-0.07 seconds.
private int lastCollumn
Previous grid column position. Field exists but usage not found in current implementation. Note: Field name contains spelling error ("Collumn" instead of "Column").
protected float lastDashSpeedM = 1f
Previous frame's dash speed multiplier value. Used for smooth interpolation of dash speeds and to detect dash state changes. Helps create fluid dash animations and movement curves.
protected float lastJumpTime
Timestamp of most recent jump action. Used for various jump cooldowns: 0.08s minimum between jumps, 0.2s for wall jumps, and 0.3s for ceiling grab attempts.
protected float lastLandTime
Timestamp of the most recent ground landing. Used for "coyote time" or grace jumping, allowing jumps shortly after leaving a platform. Enables more forgiving platforming by permitting jumps within a small window after walking off ledges.
protected Transform lastParentedToTransform
Tracks previous parent transform for detecting parent changes. Used to apply momentum when switching parents or leaving a moving platform. Set to null in Initialize.
protected Vector3 lastParentPosition
Intended to store previous parent position. Field exists but is never used in current implementation.
protected Vector3 lastParentWorldPos
Caches parent's world position for movement calculations. Used to calculate parentedDiff in ShiftUnitWithParent based on position changes.
private int lastRow
Previous grid row position. Field exists but usage not found in current implementation. Likely intended for grid-based movement tracking.
protected bool ledgeGrapple
Indicates if the character is currently grabbing a ledge. Works with wasLedgeGrapple for state transition detection.
protected float ledgeOffsetY
Vertical offset applied when grabbing ledges. Used to calculate which animation frame to display during ledge grapple animations, with values typically ranging from 0 to 13.
protected float leftTapTime
Timestamp of the last left direction button press. Used with minDashTapTime to detect left double-tap for dashing.
public float maxFallSpeed = -400f
Terminal velocity limit for falling in units per second (default -400). Prevents acceleration beyond this speed when falling. Can be modified temporarily by abilities or environmental effects like fans or low gravity zones.
public float maxWallClimbYI = 100f
Maximum upward velocity allowed when initiating wall climbing. Default value of 100 prevents climbing at high speeds. Different units may have different values (e.g., Alien: 250).
protected float minDashTapTime = 0.33f
Maximum time window (0.33 seconds) between two directional taps to trigger a dash. If second tap occurs within this window, dash is initiated.
private float noclipSpeed = 200f
Movement speed when in level editor noclip mode. Default value of 200 units per second. Only active when Map.isEditing and LevelEditorGUI.NoClip are true. Speed increases while moving up to +300/sec.
private float oldJumpForce = -1f
Unused field that was likely intended to store the original jump force during temporary modifications. Initialized to -1 but never used in implementation.
protected float originalMaxFallSpeed = -400f
Stores the default terminal velocity value (default -400). Used to restore normal falling physics after temporary modifications from abilities or effects. Ensures fall speed limits return to baseline after special states.
protected float parachuteTemporyPositionY
Smooth Y-position interpolation for parachute deployment visuals. Initialized to camera position when parachute activates and gradually moves up toward actual position at 250 units/second. Creates smooth "pulling up" effect for attached visual elements.
protected Vector3 parentedDiff
Movement difference calculated when parented to moving objects. Applied to unit position and transfers momentum (adds to xIBlast/yI) when leaving parent.
protected float parentHasMovedTime
Timer tracking when parent object has moved. Set to 0.5 seconds when parent moves and affects wall drag mechanics while positive. Decrements by delta time in RunMovement.
protected float parentVelocityInheritM = 1f
Multiplier for inheriting velocity from parent objects. Default value of 1.0 applies full parent velocity. Used when unimpaling and in movement calculations. Reset to 1 after impalement ends.
protected float rightTapTime
Timestamp of the last right direction button press. Used with minDashTapTime to detect right double-tap for dashing.
public float rumbleAmountPerShot = 0.3f
Controller vibration intensity per shot fired. Default value of 0.3. Intended for gamepad feedback but not actively used in base implementation.
protected float screenMaxX
Maximum X coordinate of current camera/screen boundary. Set via SetResolutionCamera.GetScreenExtents. Used for screen constraint checks and respawn positioning.
protected float screenMaxY
Maximum Y coordinate of current camera/screen boundary. Set via SetResolutionCamera.GetScreenExtents. Used for top-of-screen constraints in MapExtents mode.
protected float screenMinX
Minimum X coordinate of current camera/screen boundary. Set via SetResolutionCamera.GetScreenExtents. Used with screenMaxX to calculate screen center for respawning.
protected float screenMinY
Minimum Y coordinate of current camera/screen boundary. Set via SetResolutionCamera.GetScreenExtents. Used to detect when character falls below screen (with 30 unit buffer).
public float specialAttackXIBoost
Horizontal velocity boost applied during special attacks. Added to total velocity calculation to provide special move momentum.
public float specialAttackYIBoost
Vertical velocity boost applied during special attacks. Added to vertical velocity calculation to provide special move momentum.
public float speed = 110f
Base horizontal movement speed in units per second (default 110). Core value used throughout movement calculations for walking and running. Modified by various factors like terrain, status effects, and attached enemies.
protected float standingHeadHeight = 18f
Default head height when standing in units. Default value of 18 sets initial headHeight and is restored when standing up from crouch.
public bool useAttackJumpForceForAttack
Flag indicating if special attack jump force should be used for attacks. Checked by AI systems to determine attack behavior and triggers temporary jump force modification.
protected bool wallClimbing
Current wall climbing state flag. Set true when initiating wall climb. Affects movement physics, animations, and special moves like air dash. Reset when leaving walls or transitioning states.
protected Transform wallClimbingWallTransform
Reference to wall being climbed. Set in AssignWallTransform when touching walls and used as part of the parenting system. Reset to null in ShiftUnitWithParent.
protected Vector3 wallClimbingWallTransformLocalPos
Local position on wall for climbing calculations. Set using InverseTransformPoint in AssignWallTransform and returned by GetParentedToPos during wall climbing.
protected bool wallDrag
Indicates if the character is sliding down a wall. When set to true, triggers wall drag audio loop and can initiate wall climbing if conditions are met. Automatically deactivates parachute when wall dragging begins.
protected float wallDragTime
Timer controlling wall sliding effect when touching walls. Set to 0.2 seconds on wall contact and prevents downward movement while active. Creates a brief "stick" effect that slows descent along walls.
protected bool wasConstrainedLeft
Previous frame's left wall collision state. Updated from constrainedLeft each frame. Used to detect wall release for state transitions.
protected bool wasConstrainedRight
Previous frame's right wall collision state. Updated from constrainedRight each frame. Used to detect wall release for state transitions like ceiling hanging.
protected bool wasDashing
Previous frame's dash state, used for state change detection. Compared with current dashing state to trigger dash start effects and sounds.
protected bool wasLedgeGrapple
Previous frame's ledge grapple state. Used for edge detection to determine when ledge grabbing begins or ends.
protected bool wasWallClimbing
Previous wall climbing state. Field exists but is never used in current implementation.
protected bool wasWallDragging
Previous frame's wall drag state for transition detection. Updated from wallDrag each frame. Used to detect wall drag state changes and prevents immediate re-grabbing of walls after release.
private float waterDampingX = 0.95f
Horizontal movement damping factor when submerged in water. Default value of 0.95 multiplies xI and xIBlast velocities, creating water resistance.
private float waterDampingY = 0.65f
Vertical movement damping factor when submerged in water. Default value of 0.65 multiplies yIT velocity, creating stronger vertical water resistance than horizontal.
public float xIAttackExtra
Additional horizontal velocity during attack animations. Used by characters like BroLee for martial arts moves and BrocSnipes for sniper recoil. Reset to 0 after attacks complete.
public float xIBlast
Horizontal knockback velocity component from explosions and impacts. Clamped to [-200, 200] range and affected by water damping. Adds to total velocity calculation without affecting base movement.
protected float xIT
Frame-interpolated horizontal movement distance. Calculated as (xI + xIBlast + xIAttackExtra + specialAttackXIBoost) * deltaTime. Modified by wall constraints and water damping. Reduced by 0.95x when carrying objects.
public float yIBlast
Vertical knockback velocity component from explosions. Set via SetVelocity method and added to vertical velocity with clamping. Creates upward or downward force from impacts.
protected float yIT
Frame-interpolated vertical movement distance. Calculated as (yI + specialAttackYIBoost) * deltaTime each frame. Modified by water damping, constraints, and traps. Represents actual vertical position change per frame.
Animation & Sprite Systems
Methods
protected virtual void AnimateActualDuckingRunning()
Specialized ducking run animation that uses an 8-frame cycle with foot effects every 4 frames. Adjusts gun position to (2f, -1f) to accommodate ducking pose and includes submersion checks for particle effects.
public virtual void AnimateActualIdleDuckingFrames()
Provides the base ducking idle animation with adjusted gun positioning. Similar to standing idle but uses a different frame and positions gun at offset (2f, -1f) to accommodate the ducking pose.
public virtual void AnimateActualIdleFrames()
Provides the base standing idle animation when the character is not performing any special actions. Activates gun, sets frame rate to 0.0667f, and displays a static pose. Conditionally sets gun sprite based on firing state.
protected virtual void AnimateActualJumpingDuckingFrames()
Handles specific jumping animation frames when character is in ducking state during jump.
protected virtual void AnimateActualJumpingFrames()
Manages complex jumping animation frames based on vertical and horizontal velocity. Supports three distinct velocity states: fast rising (yI > 20f), fast falling (yI < -55f), and normal jumping. Includes gun positioning and frame validation with different animations for varying movement speeds.
protected virtual void AnimateActualNewRunningFrames()
Running animation with environmental responsiveness. Adjusts frame rate based on quicksand (3x slower) and barbed wire (2x slower) conditions. Generates foot particle effects every 4 frames when not submerged and plays footstep sounds. Supports dash animation states.
protected virtual void AnimateAirdash()
Handles horizontal air dash animation with direction-based sprite selection and timing.
protected virtual void AnimateAirdashDown()
Handles downward air dash animation with specific sprite frames and timing.
protected virtual void AnimateChimneyFlip()
Handles chimney flip animation sequence for wall-to-wall traversal between narrow spaces.
protected virtual void AnimateHanging()
Handles hanging animation from ledges or ceilings with proper sprite positioning and timing.
protected virtual void AnimateHighFiveHold()
Handles animation for holding high-five gesture with proper timing and visual feedback.
protected virtual void AnimateHighFiveRelease()
Handles animation for releasing/completing high-five gesture with celebration effects.
protected virtual void AnimateIdle()
Main idle animation dispatcher that routes to specific animations based on character state. Implements a priority hierarchy system that handles ducking versus standing states separately. Routes to appropriate sub-animations including melee, high-five, special abilities, rolling, gestures, and dancing based on current character flags.
protected virtual void AnimateImpaled()
Handles impalement animation with different frames for living versus dead characters. Living characters use a clamped frame range, while dead characters or aliens use a specific static frame. Deactivates gun and resets sprite offset during impalement.
protected virtual void AnimateImpaledByChainSaw()
Sets a specific animation frame for chainsaw impalement death. Deactivates the gun and resets sprite offset. Simpler than regular impalement animation.
protected virtual void AnimateJumping()
Handles jumping animation sequences including takeoff, flight, and landing preparation phases.
protected virtual void AnimateLedgeGrapple()
Handles ledge grappling animation with grabbing and climbing motion sequences.
protected virtual void AnimateMelee()
Virtual method for melee attack animation. Empty implementation that can be overridden by derived classes.
protected virtual void AnimateOnBackOffUnit()
Sets the sprite frame for when the character is backing away from another unit.
protected virtual void AnimatePockettedSpecial()
Executes pocketed special ability animation sequence. Manages 10-frame animation cycle, triggers ability execution at frame 4, and handles gun deactivation/reactivation throughout the sequence.
protected virtual void AnimatePushing()
Animates character pushing objects with specialized timing and gun orientation. Uses 3x slower frame rate than normal running, flips gun sprite horizontally (scale -1f on X-axis), and uses a specific sprite sheet row. Plays footstep sounds every 4 frames.
protected virtual void AnimateRolling()
Animates the rolling sequence using a countdown-based frame system. Sets frame rate to 0.025f, deactivates the gun during rolling, and plays landing sound at frame 7 of the sequence.
protected virtual void AnimateRunning()
Main running animation dispatcher with comprehensive state priority system. Handles throwable objects, melee, special abilities, pushing, and rolling states. For base running, generates environmental effects including foot particles and sounds. Adapts frame rate for quicksand environments.
protected virtual void AnimateSpecial()
Handles special ability animation sequences. Manages timing, facing direction, and animation state for special moves.
protected virtual void AnimateSpecial2()
Virtual method for secondary special ability animation. Empty implementation that can be overridden by derived classes.
protected virtual void AnimateSpecial3()
Virtual method for tertiary special ability animation. Empty implementation that can be overridden by derived classes.
protected virtual void AnimateSpecial4()
Virtual method for quaternary special ability animation. Empty implementation that can be overridden by derived classes.
protected virtual void AnimateStrungUpFrames()
Sets the sprite animation frame for when the character is strung up or hanged. Displays a static death pose frame.
protected virtual void AnimateThrowingHeldObject()
Handles animation for throwing held objects like grenades or mooks. Sets throwing state and manages object release timing.
protected virtual void AnimateZipline()
Handles zipline traversal animation with movement-based sprite selection and timing.
protected virtual void CreateFaderTrailInstance()
Creates a fading trail effect sprite at character's current position and rotation. Instantiates fader sprite prefab, matches character's scale and material properties, and configures sprite dimensions for trail visualization.
protected virtual void RunGun()
Updates gun animation by managing frame timing. Increments gun counter and decreases gun frame when not wall dragging, calling SetGunSprite to update visuals when frame changes occur.
protected virtual void SetGunSprite(int spriteFrame, int spriteRow)
Sets the gun sprite frame and row based on current character state. Uses special hanging frame offset when hanging, climbing one-armed, or on zipline.
Parameters:
- int spriteFrame: The frame index for the gun sprite
- int spriteRow: The row index for the gun sprite sheet
protected virtual void SetSpriteOffset(float xOffset, float yOffset)
Sets sprite rendering offset for visual positioning adjustments during animations.
Parameters:
- float xOffset: X coordinate offset for sprite positioning
- float yOffset: Y coordinate offset for sprite positioning
Properties
public Material material { get; set; }
Gets or sets the shared material of the MeshRenderer. This property provides direct access to modify the character's visual appearance.
public MeshRenderer Renderer { get; set; }
Gets the MeshRenderer component attached to this GameObject. Uses lazy initialization to cache the component reference for performance.
Fields
protected Material _frozenGunMaterial
Cached material for frozen gun appearance. Currently not actively used in TestVanDammeAnim - the Freeze method creates materials directly. May be used by derived classes or reserved for optimization to avoid material creation during gameplay.
protected Material _frozenMaterial
Cached material for frozen appearance. Currently not actively used in TestVanDammeAnim - the Freeze method creates materials directly. May be used by derived classes or reserved for optimization to avoid material creation during gameplay.
protected Material _oilyGunMaterial
Cached material for oil-covered gun appearance. Applied alongside _oilyMaterial to ensure both character and weapon show oil coverage. Uses the same oil shader as character material for consistent visual effect.
protected Material _oilyMaterial
Cached material for oil-covered appearance. Applied when the character is covered in oil, giving a dark, slick visual effect. Created on-demand using special oil shader with darkened color values for visual feedback of flammable state.
public Shrapnel[] blood
Array of blood shrapnel prefabs intended for visual effects. Currently unused in favor of EffectsController.CreateBloodParticles() which uses the bloodColor field instead. Likely reserved for custom blood particle effects in derived classes.
protected GestureElement.Gestures currentGesture
Tracks the current gesture animation being performed (salute, wave, flex, etc.). Set via SetGestureAnimation RPC method and used by AnimateGesture to display the appropriate animation frames. Gestures block movement when active and are primarily used for multiplayer emotes and character interactions.
protected Material defaultMaterial
Stores the original material of the character sprite. Used as a reference to restore normal appearance after visual effects like freezing or oil coverage. Cached during initialization to ensure proper material restoration.
protected float frameRate = 0.0667f
Animation frame playback rate in seconds per frame (default 0.0667, approximately 15 FPS). Controls the speed of sprite animations. Lower values create faster animations, higher values create slower animations.
protected float gunCounter
Animation timer for gun sprite updates. Increments by delta time and triggers frame updates every 0.0334 seconds, providing smooth gun animation at approximately 30 FPS.
protected int gunFrame
Tracks the current animation frame for weapon-related animations. Acts as a cooldown timer that prevents certain actions when greater than 0. Decremented during gun animation updates and initialized to 3 at start.
protected Material gunMaterial
Stores the original material of the gun sprite. Used to restore normal gun appearance after visual effects. Cached separately from character material since gun may have different shader properties or textures.
public SpriteSM gunSprite
Sprite renderer component for the character's weapon. Updated independently from character sprite to show weapon animations and states.
protected int gunSpriteHangingFrame = 6
Starting frame offset for gun animations when character is hanging or climbing. Default value of 6. Added to the base frame number to show different gun positions for hanging states.
protected int gunSpritePixelHeight = 32
Height of each gun sprite frame in pixels. Default value of 32 pixels. Calculated from gunSprite.pixelDimensions.y and used for sprite sheet row calculations.
protected int gunSpritePixelWidth = 32
Width of each gun sprite frame in pixels. Default value of 32 pixels. Used to calculate sprite sheet coordinates and passed to shaders for visual effects.
protected bool hangingOneArmed
Indicates whether the character is currently hanging from a ledge with one arm. Used by the animation system to display one-armed hanging sprites (row 11, frame 0) versus two-armed hanging. Set during ledge grapple mechanics.
protected CustomLineRenderer heroTrail
Active trail renderer that creates speed lines behind the hero during fast movement. Enabled when horizontal speed exceeds threshold and trail time dynamically adjusts between 0.1-0.4 seconds based on movement speed. Disabled when speed drops or hero dies.
public CustomLineRenderer heroTrailPrefab
Prefab reference for creating hero trail visual effects. Likely assigned in Unity editor and used as template for instantiating the heroTrail object. Part of the movement trail rendering system.
private GibHolder instantiatedSkeleton
Holds the skeleton or corpse object created when the character dies. Used for managing death gibs and can be exploded when hit while melting.
protected int knifeHand
Alternates which hand is used for knife climbing animations. Incremented during climbing actions and used with modulo 2 to control left/right hand animations for wall climbing.
protected float lastT = 0.1f
Time elapsed during the previous frame in seconds (default 0.1). Used for frame-independent animation timing and physics calculations. Helps smooth animations during variable frame rates.
private AnimatedTexture meltingSprite
Manages the visual effect when the character melts from acid damage. Set when the melting animation begins and checked to determine when the melting animation completes.
private MeshRenderer meshRenderer
Reference to the MeshRenderer component for 3D rendering. Rarely used directly in TestVanDammeAnim as characters primarily use sprite-based rendering. May be utilized by specific derived classes for special visual effects.
public float runningFrameRate = 0.025f
Base animation frame timing for running animations in seconds. Default value of 0.025 seconds. Multiplied by 3 for slower animations in quicksand or other special states.
protected SpriteSM sprite
Main SpriteSM component responsible for rendering the character sprite. Initialized from GetComponent in Awake and used extensively throughout animation methods to control sprite sheet navigation via SetLowerLeftPixel, texture updates, and visual effects like color changes.
protected Vector3 spriteOffset
Stores the original sprite offset position from initialization. Used as the base reference point when applying temporary sprite position adjustments via SetSpriteOffset, allowing the sprite to return to its original position after effects.
protected int spritePixelHeight = 32
Height of each sprite frame in pixels on the sprite sheet. Initialized from sprite.pixelDimensions.y in Awake and used in SetLowerLeftPixel calculations to navigate sprite sheet rows during animation. Default value is 32 pixels.
protected int spritePixelWidth = 32
Width of each sprite frame in pixels on the sprite sheet. Initialized from sprite.pixelDimensions.x in Awake and used in SetLowerLeftPixel calculations to navigate sprite sheet columns during animation. Default value is 32 pixels.
public bool useDashFrames
Controls whether to use dash-specific animation frames. When true, uses row 8 frames 0-3 for horizontal dashing and row 9 frames 5-7 for vertical air dashing. Enables visual feedback for dash abilities when available.
public bool useDuckingFrames = true
Controls whether to display ducking/crouching animation frames. When true (default), shows proper ducking sprites when character crouches. When false, character maintains standing sprite even while ducked, which can look incorrect but may be used for specific characters.
public bool useLadderClimbingTransition
Enables smooth transition animations when mounting or dismounting ladders. When true, plays a transition animation for ladderClimbingTransitionFrames duration before normal climbing begins. Works with useNewLadderClimbingFrames for complete ladder animation control.
public bool useNewDuckingFrames
Configuration toggle intended for switching between old and new ducking animation sets. Currently not actively used in the code but reserved for future animation system updates.
public bool useNewFrames
Configuration toggle intended for using updated animation frames. Currently not actively used in the code but reserved for future general animation system updates.
public bool useNewHighFivingFrames
Controls whether to use updated animation frames for high-five interactions. When true, uses frames 4-5 from row 1 of the sprite sheet for the high-five gesture. Set per-character to enable or disable the high-five animation system.
public bool useNewKnifeClimbingFrames
Controls whether to use updated animation frames for knife wall climbing. When true, uses frames from row 5 of the sprite sheet instead of generic climbing frames. Set per-character in Unity Inspector to customize wall climbing animations.
public bool useNewKnifingFrames
Toggle that switches between old and new melee/knifing animation sets. When enabled, uses different animation frames and movement patterns in AnimateMelee and RunMeleeMovement, affecting both the visual presentation and physics of melee attacks.
public bool useNewLadderClimbingFrames
Controls whether to use updated animation frames for ladder climbing. When true, uses frames from row 4 of the sprite sheet instead of generic climbing frames. Set per-character to customize ladder climbing animations.
public bool useNewLedgeGrappleFrames
Controls whether to use updated animation frames for ledge grappling. When true, uses frames from row 11 of the sprite sheet for the ledge hanging animation. Set per-character to enable new ledge grapple visuals.
public bool useNewPushingFrames
Toggles between old and new pushing animation frames. When true, uses updated sprite frames for the block pushing animation.
public bool useNewThrowingFrames
Toggle that switches between old and new throwing animation sets. When false, uses frames 17-22 on row 1; when true, uses frames 17-24 on row 5. Affects both the throwing animation sequence and held object positioning during throws.
protected bool wasHangingMoving
Tracks state change for hanging movement animations. Set to true when starting hanging movement and used to detect transition from moving to stationary while hanging.
protected float yScale = 1f
Maintains the vertical scale of the sprite (default 1.0). Preserved during direction changes to ensure consistent sprite appearance. Some derived classes may modify this for special visual effects like squashing or stretching animations.
Character State & Effects
Methods
protected virtual void AlertNearbyMooks()
Alerts nearby enemy units to player presence within 8x8 unit area. Updates last alert time for tracking alert frequency.
protected virtual void AnimateFrozen()
Sets the visual appearance when the character is frozen. Deactivates the gun sprite and sets the character sprite to frame 11 (frozen pose) on the sprite sheet. This method is called by Freeze to establish the frozen visual state.
public override void Blind()
Stuns the character for a specified duration, applying a blindness effect that prevents all actions. In DeathMatch mode, heroes receive a 70% reduction in stun duration. Also calculates a vocal delay (0.2-0.7 seconds) for playing stun sound effects.
Parameters:
- float time: Duration in seconds to remain stunned
public override void Blind()
Applies a default 3-second blind/stun effect to the character. Immediately stops all movement and sets the stun timer, with the same vocal delay calculation as the timed version for sound effects.
public virtual void Boost(float time)
Applies temporary speed boost effect for specified duration.
Parameters:
- float time: Duration of boost effect in seconds
public virtual void BrosMustFailToWin()
Marks a player unit as needing to fail for victory conditions. Only applies to player-controlled units and disables gibbing to ensure proper failure tracking.
protected virtual void CalculateZombieInput()
Processes input for zombie units by copying control inputs from their revive source. Decrements zombie delay timer and explicitly disables special abilities for zombies.
public override bool CanBeThrown()
Determines if the character can be thrown by other units. Characters that are heavy or currently impaled cannot be thrown.
Returns:
bool
: True if the character can be thrown, false if heavy or impaled
public override bool CanFreeze()
Checks if the hero can be affected by freeze effects. Base implementation always returns true, can be overridden for freeze-immune heroes.
Returns:
bool
: True if the hero can be frozen
public override void CheckDestroyed()
Handles character destruction cleanup. Removes from map tracking, reduces lives if applicable, and triggers unit destruction.
protected virtual void CheckFacingDirection()
Manages character facing direction based on movement, input, and special abilities. Prevents direction changes during chimney flips, air dashes, or when configured to maintain special facing direction.
protected virtual void CheckNotifyDeathType()
Checks if enough time has passed since death to notify death type. Calls NotifyDeathType after 0.33 second delay.
protected virtual void CopyInput(TestVanDammeAnim zombie, ref float zombieDelay, ref bool up, ref bool down, ref bool left, ref bool right, ref bool fire, ref bool buttonJump, ref bool special, ref bool highFive)
Copies control inputs from one unit to another, primarily used for zombie control. If the source is alive, copies all input states. If dead, sets all inputs to false.
Parameters:
- TestVanDammeAnim zombie: The source unit to copy inputs from
- out float zombieDelay: Delay timer reference (not modified by this method)
- out bool up: Up input state to set
- out bool down: Down input state to set
- out bool left: Left input state to set
- out bool right: Right input state to set
- out bool fire: Fire input state to set
- out bool buttonJump: Jump input state to set
- out bool special: Special input state to set
- out bool highFive: High-five input state to set
protected virtual void CreateElectricShockPuff(float yOffset)
Creates a visual electric shock effect at the hero's position. Adds random positioning offsets for variation and randomly flips the effect horizontally. Parents the effect to the hero's transform so it follows movement.
Parameters:
- float yOffset: Vertical offset from the hero's position for the effect
public void CreateSkeleton()
Creates appropriate skeleton prefab based on character type (BigGuy, HellLostSoul, Grenadier, etc.) for death/melting animations. Only creates if skeleton doesn't already exist.
public override void Dance(float time)
Makes the character dance for the specified duration. Sets dance timer and applies a stun effect for the same duration to prevent movement during the dance.
Parameters:
- float time: Duration of the dance in seconds
public virtual void DelayedRevive(float delay)
Handles delayed revival mechanics for the hero. Virtual method intended for override by specific revival implementations.
Parameters:
- float delay: Time in seconds before revival occurs
public virtual void DestroyUnit()
Virtual method that destroys the game object. Can be overridden by derived classes for custom destruction behavior.
public virtual void Disable()
Disables the component to prevent updates and behavior. Sets the enabled state to false.
protected virtual void FireFlashAvatar()
Triggers the avatar firing flash effect with a short animation timer (0.04 seconds). Sets the avatar to fire state and applies controller rumble feedback for firing actions.
public override void Freeze(float time)
Freezes the character with a frozen visual effect for a specified duration. Creates frozen materials using a special "Frozen" shader with blue tint (0.094f, 0.388f, 0.718f) and applies them to both character and gun sprites. The character is immobilized and plays a freeze scream sound effect while in this state.
Parameters:
- float time: Duration in seconds to remain frozen
public void HideAndDisableCharacter()
Completely hides and disables the character from gameplay. Disables rendering, main script, AI, and collision while setting invulnerability. Used for cutscenes or special game states.
public override void Impale(Transform impaleTransform, Vector3 direction, int damage, float xI, float yI, float xOffset, float yOffset)
Impales the character on a transform, drastically reducing movement capability while maintaining position constraints.
Parameters:
- Transform impaleTransform: The transform to impale the character on.
- Vector3 direction: The direction of the impaling force.
- int damage: The amount of damage to apply.
- float xI: The horizontal velocity component.
- float yI: The vertical velocity component.
- float xOffset: Horizontal offset from the impale transform.
- float yOffset: Vertical offset from the impale transform.
public virtual bool IsExitingDoor()
Checks if the character is currently exiting a door. Base implementation always returns false, intended for override by derived classes.
Returns:
bool
: True if exiting a door, false otherwise
public override bool IsFlexing()
Checks if the hero is performing a flex gesture. Requires the unit to be a hero and currently in the Flex gesture state.
Returns:
bool
: True if the hero is flexing
public virtual bool IsHanging()
Checks if the unit is currently in a hanging state. Returns true when actionState equals Hanging.
Returns:
bool
: True if the unit is hanging
public override bool IsIncapacitated()
Checks if the hero is currently stunned or frozen. Returns true if either stun time or frozen time is active.
Returns:
bool
: True if the hero cannot act due to stun or freeze
public override bool IsInQuicksand()
Checks if the hero is currently sinking in quicksand. Returns the current quicksand state tracked by the movement system.
Returns:
bool
: True if the hero is in quicksand
public void Melt()
Initiates melting animation sequence using character-specific melting prefabs. Sets melted state and creates appropriate melting effects for different enemy types and states.
public virtual bool MustBroFailToWin()
Checks whether this unit must fail for the victory condition to be met. Used in special game modes where player failure is the objective.
Returns:
bool
: True if this unit must fail for victory
public virtual void RecallBro()
Handles character recall/respawn with visual fade effect. Switches to transparent shader, changes layer to Effects, removes from map tracking, and assigns to spectator player. Network RPC method that can be called remotely.
public virtual void ReceiveHeroKillReport(KillData killData)
Receives notification when this hero kills another unit. Virtual method intended for override by specific hero implementations.
Parameters:
- KillData killData: Data about the kill including victim and damage type
protected virtual void ReduceLives(bool destroyed)
Decrements player lives when the character dies. Only processes for the owning player, prevents double processing, and notifies HeroController of the death.
Parameters:
- bool destroyed: Whether the character was completely destroyed
public virtual void Reenable()
Re-enables the component after it has been disabled. Sets the enabled state to true.
protected void ReplaceWithSkinnedInstance(Unit skinnedInstance, float _x, float _y)
Replaces this unit instance with a skinned version, transferring all state and properties to the new instance.
Parameters:
- Unit skinnedInstance: The skinned unit instance to replace this one with.
- float _x: The X position for the replacement unit.
- float _y: The Y position for the replacement unit.
protected virtual void RestartBubble()
Restarts the player protection bubble display with default settings. Uses player options to determine if bubbles should always be shown and considers forced bros count for bubble visibility.
protected virtual void RestartBubble()
Restarts the player protection bubble with a specified duration timer. Only functions in campaign mode and checks HUD visibility and chat state before displaying the bubble for the specific player number.
Parameters:
- float time: Duration in seconds to display the protection bubble
public override bool Revive(int playerNum, bool isUnderPlayerControl, TestVanDammeAnim reviveSource)
Revives a dead unit, either as a zombie or restoring a player character. Clears impalement state, creates revival effects, and assigns appropriate control. For players, reassigns character and adds life. For zombies, sets ownership to revive source.
Parameters:
- int playerNum: Player number to assign if reviving as player (-1 for zombie)
- bool isUnderPlayerControl: Whether the revived unit will be player-controlled
- TestVanDammeAnim reviveSource: The unit that is reviving this character (for zombie control)
Returns:
bool
: True if revival was successful
public override void RollOnto(int direction)
Applies knockback when another unit rolls onto this character. Uses the Knock method with horizontal force based on direction and fixed upward force.
Parameters:
- int direction: Direction of the rolling impact (-1 left, 1 right)
protected virtual void RunAvatarFiring()
Updates the avatar's firing animation state based on current fire input. Manages the avatar gun fire timer and switches between angry and calm states depending on whether the character is actively firing.
protected virtual void RunAvatarRunning()
Updates the avatar's running animation by creating a bouncing effect. The avatar moves up and down based on the current run animation frame, but only when the character is in the running state.
protected virtual void RunImpaledBlood()
Creates periodic blood particle effects when the character is impaled. Manages blood spurts with randomized timing, limits effects to 5 spurts maximum, and uses artery effects for dramatic visual impact.
public virtual void RunTrail()
Manages the visual trail effect based on character movement speed. Enables trail when moving faster than 50% speed, with trail duration scaling from 0.1 to 0.4 seconds. Disables trail when dead or moving slowly.
public void SetGibThreshold(int newThreshold)
Sets the negative health threshold at which the hero will gib instead of normal death. Lower values require more extreme damage to trigger gibbing.
Parameters:
- int newThreshold: The new gib threshold (typically negative)
public override void SetImmuneToOutOfBounds()
Makes the unit immune to death from going out of bounds. Used for special scenarios where units need to exist outside normal play area.
public virtual void SetInvulnerable(float time, bool restartBubble = true, bool showHalo = false)
Makes the character invulnerable to damage for the specified duration. Can optionally display a protection bubble and/or halo effect to indicate the invulnerable state.
Parameters:
- float time: Duration of invulnerability in seconds
- bool restartBubble: Whether to show the protection bubble (default true)
- bool showHalo: Whether to show a halo effect (default false)
public void SetSpawnState(float _xI, float _yI, bool tumble, bool useParachuteDelay, bool useParachute, bool onFire)
Sets the initial spawn conditions for the hero including velocity and status effects. Network RPC method that can be called remotely to ensure consistent spawn state.
Parameters:
- float _xI: Initial horizontal velocity
- float _yI: Initial vertical velocity
- bool tumble: Whether to start in tumbling state
- bool useParachuteDelay: Whether to apply parachute deployment delay
- bool useParachute: Whether to spawn with parachute active
- bool onFire: Whether to spawn on fire
public virtual void SetWillComebackToLife(float time)
Marks the character to respawn after death with the specified comeback timer. Shows a halo effect if not already displayed to indicate the respawn state.
Parameters:
- float time: Time in seconds before the character respawns
public void ShowAndEnableCharacter()
Network wrapper for showing a hidden character. Checks ownership before sending RPC to show the character on all clients.
public void ShowCharacterInternal()
Re-enables and shows a previously hidden character. Restores rendering, main script functionality, and grants 1 second of invulnerability. Network RPC method that can be called remotely.
public void SkinUnit()
Converts this unit to a skinned variant if the player has an active skin and network ownership.
protected virtual void SprayBlood(float range, BloodColor bloodColor)
Creates blood splatter effects on nearby surfaces using raycasts. Performs a raycast in a random direction from above the character and applies blood to hit blocks. Also triggers area blood effects through Map.BloodyDoodads.
Parameters:
- float range: Maximum distance for blood spray raycasts
- BloodColor bloodColor: Color of the blood to spray
public virtual void Stop()
Immediately halts all character movement and actions. Clears all input flags, sets velocity to zero, resets melee states, and sets to idle if not dead.
protected virtual void StopBeingStunned()
Virtual method for ending stun effects. Empty implementation that can be overridden by derived classes.
protected virtual void StopBubble()
Stops the player protection bubble display for the specific player number (0-3). Used when invulnerability expires or when the bubble should be hidden.
public override void Stun(float time)
Applies a stun effect with default duration of 0.33 seconds. Calls the overloaded Stun method with the default time value.
public override void Stun(float time)
Applies a stun effect for the specified duration. Stops character movement, sets stun timer, resets blind counter if negative, and calculates vocal delay for stun sound effects based on duration.
Parameters:
- float time: Duration of the stun effect in seconds
protected void SuckIntoPortal()
Handles the character being sucked into an exit portal with visual effects. Adds SpinAndScaleDown component for the portal animation, stops protection bubbles and syncing, and links the character to the exit portal instance. RPC-enabled for network synchronization.
public virtual void TempInvulnerability(float time)
Grants temporary invulnerability to TestVanDammeAnim for a specified duration. Sets invulnerable state and resets fired-while-invulnerable tracking.
Parameters:
- float time: Duration of invulnerability in seconds. If 0 or negative, uses default duration of 1.2 times the current frame delta time (very brief)
public virtual void TimeBroBoost(float time)
Applies time-based character boost effect for specified duration.
Parameters:
- float time: Duration of time boost effect in seconds
public void UnFreeze()
Removes the frozen state and restores the character's normal appearance. Resets the frozen timer to 0 and restores the default materials for both the character renderer and gun sprite (if present). This allows the character to resume normal movement and actions.
public override void Unimpale(int damage, DamageType damageType, float xI, float yI, MonoBehaviour firedBy)
Removes the character from an impaled state, applying damage and velocity while clearing impalement constraints.
Parameters:
- int damage: The amount of damage to apply when unimpaling.
- DamageType damageType: The type of damage being applied.
- float xI: The horizontal velocity to apply after unimpaling.
- float yI: The vertical velocity to apply after unimpaling.
- MonoBehaviour firedBy: The source that caused the unimpaling.
protected virtual void Unrevive()
Forces the character to die after being revived. Deals crush damage equal to health+1 with knockback based on facing direction.
protected virtual void Unrevive()
Forces the character to die after being revived. Deals crush damage equal to health+1 with knockback based on facing direction.
public override Vector3 WhereDidIDie()
Returns the position where the hero died for respawn or tracking purposes. Returns the recorded death position if killed by another hero, otherwise returns current position.
Returns:
Vector3
: The world position where death occurred
public virtual void YouKilledMe(Unit unit)
Called when this hero kills another unit. Virtual method intended for override to handle kill-specific behavior.
Parameters:
- Unit unit: The unit that was killed
Properties
public float counter { get; set; }
Gets or sets the animation frame timing counter. This counter accumulates delta time and triggers the next animation frame when it exceeds the frameRate threshold (0.0334 seconds).
public Transform impaledByTransform { get; set; }
Gets or sets the Transform that is currently impaling this unit. Setting this property also updates the related Impaler component reference.
protected float invulnerableTime { get; set; }
Gets or sets the remaining invulnerability duration in seconds. When greater than zero, the character cannot take damage.
public bool IsDucking { get; set; }
Gets a value indicating whether the character is currently in a ducking or crouching state.
public bool IsFrozen { get; set; }
Gets a value indicating whether the character is currently frozen by freeze effects.
public override bool IsParachuteActive { get; set; }
Gets or sets a value indicating whether the parachute is currently active. Setting this property manages parachute GameObject visibility, physics effects, and landing invulnerability.
public virtual bool IsPerformanceEnhanced { get; set; }
Gets a value indicating whether performance enhancement effects are currently active. This base implementation always returns false.
public virtual bool WillReviveAlready { get; set; }
Gets a value indicating whether this unit will be automatically revived. This base implementation always returns false.
Fields
protected float avatarAngryTime
Unused in base class. Reserved for BroLee implementation to control avatar/clone anger state in derived classes.
protected float avatarGunFireTime
Unused in base class. Reserved for BroLee implementation to control avatar/clone firing timing in derived classes.
protected float blindCounter
Counter for blind effect intervals. Incremented while blinded and triggers visual effects every 0.1 seconds. Reset when entering stun state. Creates periodic screen flash effects to indicate blindness status.
public int bloodCountAmount = 80
Number of blood particles to spawn on death. Default value of 80. Used in particle creation (divided by 4) and SprayBlood calls to control visual gore intensity.
protected float bloodTime
Current blood effect timer. Decremented by 0.0667 per update. When positive, creates blood particles using character's bloodColor property.
protected float bloodTimeOut
Total duration limit for blood effects. Not directly used in visible base implementation but likely controls maximum blood effect duration.
public bool canBeCoveredInAcid = true
Determines if this unit can be affected by acid coverage effects (default true). When false, prevents acid visual effects and damage over time. Checked before applying acid materials and status effects. Some boss units may disable this.
public bool canBeStrungUp
Determines if this unit can be hung or strung up by certain traps or abilities. Currently not actively used in the codebase. May have been intended for trap mechanics or special death states where units could be suspended.
public bool canDuck = true
Determines if the character is allowed to duck. Default is true. Checked in StartDucking method and movement collision logic to enable/disable ducking ability.
public bool canUnFreeze
Determines if the frozen status can expire naturally over time. When true, frozenTime decrements each frame allowing automatic thawing. When false, unit remains frozen indefinitely until explicitly unfrozen by external effects.
protected bool controllingProjectile
Unused in base class. Used by specific characters (BroDredd, BronnarJensen, BroGummer) to indicate when character is remotely controlling a projectile.
protected float controllingProjectileDelay
Unused in base class. Intended for timing mechanics to prevent immediate re-control after releasing a projectile.
protected int dancingFrames = 12
Number of animation frames in the dancing sequence. Default value of 12 frames creates the complete dance animation cycle. Used with frame modulo calculation for smooth looping dance animation.
protected Vector2Int dancingFramesSheetPosition = new Vector2Int(15, 14)
Starting position on the sprite sheet for dancing animation frames. Default Vector2Int(15, 14) points to row 15, column 14. The X coordinate is combined with current frame modulo for animation progression.
protected float dancingTime
Duration in seconds remaining for dance effect. Decremented each frame alongside stunTime. Character dances only when both stunTime and dancingTime are greater than zero. Set by Dance() method for forced dancing.
protected float deadHeadHeight = 10f
Character's head height when dead in units. Default value of 10. Set in ConstrainToCeiling when actionState is Dead. Ensures dead bodies have appropriate collision boundaries.
protected float deadWaistHeight = 5f
Character's waist height when dead in units. Default value of 5. Lower than standing/ducking heights to reflect prone dead position.
public float deathSoundVolume = 0.7f
Volume multiplier for death sound effects. Default value of 0.7. Applied at various levels (50% or 100%) to control death sound loudness.
public bool doRollOnLand
Enables rolling animation when landing from significant falls. When true, character performs a roll if landing with high downward velocity (yI < -300). The roll lasts 0.133 seconds and prevents other actions during that time. Provides smooth landing from high falls.
protected bool ducking
Tracks if the character is in a ducking/crouching state. Affects hitbox dimensions, prevents wall climbing, modifies movement speed, and changes animation frames when useDuckingFrames is true.
protected float duckingHeadHeight = 13f
Character's head height when ducking in units. Default value of 13. Set in StartDucking method and used to adjust collision detection height when crouched.
protected float duckingToeHeight = 5f
Character's toe height when ducking in units. Default value of 5. Slightly higher than standing (5 vs 4), possibly representing lifted feet when crouching.
protected float duckingWaistHeight = 6f
Character's waist height when ducking in units. Default value of 6. Set in StartDucking method to reflect crouched position.
protected bool firstFrame = true
Generic first-frame flag common across many game objects. Initialized to true but not specifically used in TestVanDammeAnim implementation.
protected float frozenTime
Duration in seconds remaining for the freeze effect. When greater than zero, character is frozen solid with blue tint shader. Prevents all movement, modifies damage behavior, and affects death mechanics. Decremented only when canUnFreeze is true.
public BroHalo halo
Reference to a BroHalo visual effect component. Displays an angel halo above the character during certain states, particularly when marked for resurrection (willComeBackToLife). Provides visual feedback for special character states.
public bool HidingPlayer
Tracks whether the player character is currently hidden/disabled. Set to true in HideAndDisableCharacter for cutscenes and transitions. Character becomes invulnerable while hidden and sprites/renderers are disabled accordingly.
protected float idleTime
Tracks seconds of player inactivity. Incremented when no input is received, reset on any input. Triggers AFK bubble display after threshold and enables other players to kick idle players after extended inactivity.
protected bool immuneToOutOfBounds
When true, prevents death from falling out of map bounds. Checked before applying out of bounds damage. Allows certain heroes or special states to survive falling off the map edges.
public Impaler impaledBy
Reference to the Impaler component that has impaled this character. Used to evaluate if impalement should continue and for damage calculations. Cleared when impalement ends.
private Transform ImpaledByTransform
Private backing field for the impaledByTransform property. Stores the Transform of the object that is currently impaling this character.
protected float impaledCounter
Timer or counter for impalement state. Field exists but usage not found in current implementation. Related to impalement mechanics.
protected int impaledDamage
Stores damage value to apply when unit is unimpaled. Set during Impale method and applied as damage in Unimpale when unit is released from impalement.
protected int impaledDirection
Direction of impalement (-1 or 1) based on impact velocity. Determines position constraints and sets minor velocity (xI = -0.01f * impaledDirection) during impalement.
protected Vector3 impaledLocalPos
Local position relative to impaling object. Field exists but is never used in current implementation.
protected Vector3 impaledPosition
World position where unit was impaled. Constrains movement to ±3 units from this point while impaled to prevent excessive movement.
protected float impaleXOffset
Horizontal offset when character is impaled. Field exists but usage not found in current implementation. Likely provides visual offset for impaled state.
protected float impaleYOffset
Vertical offset for positioning when impaled by an object. Used in GetParentedToPos to calculate the Y position relative to the impaling transform.
protected bool isParachuteActive
Tracks whether the parachute is currently deployed and affecting physics. When true, applies air resistance and modified gravity. Set when parachute deploys during falls, cleared on landing or parachute destruction.
public bool isSkinnedMook
Flag indicating if this unit is a skinned mook enemy type. Public field but no usage found in TestVanDammeAnim base class.
protected DamageType lastDamageType = DamageType.None
Stores the type of damage last received by the character. Default is DamageType.None. Used for damage-specific death effects and responses, particularly explosion damage checks.
protected float lastHitSoundTime
Timestamp of when hurt sound was last played. Prevents sound spam with 0.1 second cooldown between hurt sounds. Updated when hurt sound plays.
private float meltDuration = 0.7f
Controls how long the acid melting death effect lasts in seconds. Default value of 0.7 seconds is randomized by ±0.3 seconds in Awake for visual variety.
public Parachute parachute
Reference to the Parachute component attached to this unit. Created when falling from sufficient height, destroyed on landing or damage. Provides visual parachute model and modifies falling physics when active.
protected float parachuteDelay
Countdown timer preventing immediate parachute deployment after certain actions. Decremented each frame when greater than zero. Ensures parachute doesn't deploy during attacks or immediately after jumping, requiring actual falling before activation.
public float pitchShiftAmount
Pitch modifier added to all character sound effects. Allows voice pitch variation between different characters. Applied to special, throw, hurt, and death sounds.
protected float pushingTime
Timer for push animation duration. Set to 0.06 seconds when block pushing begins and decrements each frame. Controls when to display pushing animation frames.
protected float recallCounter
Timer for the recall fade-out effect, ranging from 0 to 1. Controls sprite transparency (1 - recallCounter) during despawn. Character is destroyed when counter exceeds 1.
protected bool recalling
Indicates if the character is being recalled/despawned with a fade-out effect. When true, character fades out over 1 second before being destroyed.
protected bool reducedLife
Tracks if player has lost a life but hasn't respawned yet. Set true when player dies and reset on revival. Prevents multiple life deductions for a single death.
protected int rollingFrames
Current frame of the rolling animation sequence. Incremented based on time progression during rolls. Used to display the appropriate sprite frame from the rolling animation set on the sprite sheet.
private float rollingTime
Duration remaining for the rolling animation after landing from a high fall. Set to 0.133 seconds when landing with high velocity (yI < -300) if doRollOnLand is true. Prevents other actions during the roll animation.
private float showGestureTimer
Timer controlling gesture animation display duration. Incremented while gesture is active and reset when gesture ends. Manages the timing of victory poses and other character gestures.
private int spurtCount
Tracks number of blood spurts created for artery effects. Limited to 5 spurts maximum. Used with impaledCounter for timing blood effect intervals.
protected float standingToeHeight = 4f
Character's toe height when standing in units. Default value of 4. Set in StopDucking method as the normal foot collision height.
protected float standingWaistHeight = 10f
Character's waist height when standing in units. Default value of 10. Set in StopDucking method as the normal waist collision height.
protected float stunTime
Duration in seconds remaining for the stun effect. Decremented each frame when greater than zero. During stun, the character cannot perform actions. Combined with dancingTime to trigger dancing animations. Set by various stun methods and can be reduced for heroes in DeathMatch mode.
protected float stunVocalDelay
Delay in seconds before playing stun voice lines. Calculated when stunned with random value between 0.2 and 0.7 seconds based on stun duration. Prevents audio spam from rapid stun effects.
public static bool teaBagCheatEnabled
Static flag that enables a cheat/easter egg for tea-bagging defeated enemies. Activated by entering a specific code in the main menu. When enabled, allows players to deal "SelfEsteem" damage by ducking near dead units.
protected float timeBroBoostTime
Duration of time-based speed boost effect in seconds, likely from Time Bro's special ability. Counts down each frame and affects delta time calculations independently from high-five boosts.
protected float toeHeight = 4f
Current toe/foot height for low collision detection. Default value of 4. Used in raycasts for detecting ground-level obstacles. Dynamically changes based on stance.
protected float waistHeight = 10f
Current waist height used for collision detection. Default value of 10. Dynamically changes based on stance (standing/ducking/dead). Used extensively in raycasts and obstacle detection.
protected bool xBoxControlled
Deprecated field that is never used in the codebase. May have been intended for Xbox controller detection.
Input & Control
Methods
public override bool AnyInput()
Checks if any input button is currently pressed (movement, fire, special, jump, or high-five).
Returns:
bool
: True if any input is detected, false otherwise
protected virtual bool CanUseSwitch()
Indicates whether this character can activate switches. Default implementation returns true; subclasses can override to add conditions.
Returns:
bool
: True if the character can use switches, false otherwise
protected virtual void CheckDashing()
Manages dash state based on player input and sprint status. For local players, detects dash button presses and releases. For remote players, creates visual and audio effects when dash state changes.
protected virtual void CheckInput()
Main input processing method that handles all player and AI input. Stores previous input states, handles zombie AI input, processes player controller input, manages remote control of vehicles/projectiles, handles idle timeout and kick detection, and integrates special abilities and gestures.
protected virtual void CheckTriggerActionInput()
Processes input commands from trigger actions for scripted sequences. Handles movement commands with pathfinding, processes AI commands, tracks command completion, and integrates with PathAgent for navigation.
protected virtual void CheckWhetherShouldClearInput()
Virtual method for input clearing logic. Empty in base class, designed for override in derived classes to implement custom input clearing conditions.
public virtual void ClearAllInput()
Performs a comprehensive reset of all input states. Clears current and previous states for movement, jumping, fire, special, high-five, and taunt buttons.
protected virtual void ClearFireInput()
Resets all fire-related input states including fire, special abilities, and high-five inputs. Used to clear attack inputs when needed.
protected void DebugShowInput(bool left, bool right, bool up, bool down, bool jump, bool climb)
Debug method to display current input state. Shows formatted string with L/R/U/D/J/C states when debug mode is enabled.
Parameters:
- bool left: Left input state
- bool right: Right input state
- bool up: Up input state
- bool down: Down input state
- bool jump: Jump input state
- bool climb: Climb input state
protected virtual void GetEnemyMovement()
Retrieves AI input for enemy-controlled characters. Calls enemyAI or EnemyAI component for input and passes multiple input references for various actions.
protected virtual bool GetSprintValue()
Returns the current sprint state of the character.
Returns:
bool
: True if the character is sprinting, false otherwise.
public override bool IsPressingDown()
Returns whether the down input is currently being pressed.
Returns:
bool
: True if the down button is currently held, false otherwise
public override bool IsPressingLeftOrRight()
Checks if the player is pressing either left or right directional input. Used for movement detection and control state queries.
Returns:
bool
: True if left or right input is active
protected virtual bool MustIgnoreHighFiveMeleePress()
Determines if high-five/melee input should be ignored based on current state. Returns true if holding a grenade/mook or using any special abilities.
Returns:
bool
: True if the input should be ignored, false if it can be processed
protected virtual void PressDashButton()
Initiates dashing when the dash button is pressed, but only if the character is not already dashing and is moving left or right.
protected virtual void PressHighFiveMelee(bool forceHighFive = false)
Handles the high-five/melee button press with complex interaction priority logic. Checks for nearby grenades, mooks, switches, teleport doors, citizens, and other players. Prioritizes interactions based on game mode, proximity, and current state.
Parameters:
- bool forceHighFive: Forces a high-five attempt regardless of other potential interactions
protected virtual void PressSpecial()
Initiates special ability use when the special button is pressed. Only activates if the character is not covered in acid and not performing a melee attack.
protected virtual void PressSpecial2()
Placeholder method for secondary special ability activation. Currently only resets the animation frame to 0.
protected virtual void ReleaseDashButton()
Stops dashing when the dash button is released, calling StopDashing to handle dash end logic.
protected virtual void ReleaseFire()
Virtual method called when the fire button is released. Empty implementation for subclasses to add weapon-specific release behavior.
protected virtual void ReleaseSpecial()
Virtual method called when the special ability button is released. Empty implementation for subclasses to override.
protected virtual void RunForcedInput()
Processes forced input timers that override player control. Manages hold timers for up, left, right directions and forces specific inputs while timers are active.
protected virtual void StopLeftRightInputFromHanging()
Clears horizontal movement input when hanging. Prevents left/right movement while character is in hanging state.
Properties
public short InputBits { get; set; }
Gets or sets the packed input states for network synchronization. This property packs 11 boolean input flags into a single short value for efficient network transmission.
Fields
protected float airDashJumpGrace
Grace period timer allowing jumps shortly after air dashing. Provides a brief window where jump input is accepted even if not technically grounded. Enables fluid air dash to jump combos for advanced movement.
private bool blockMovementForGesture
Prevents movement input during gesture animations. Set to true when starting gestures and blocks movement processing until gesture completes.
protected bool buttonGesture
Current frame's gesture button input state from player controls. Used with wasButtonGesture for edge detection to trigger gesture-based actions.
public bool buttonHighFive
Current frame's high-five button state. True when high-five/interaction button is pressed. Triggers cooperative high-five actions when near other players. Also used for general player interactions.
public bool buttonJump
Current frame's jump button state. True when jump button is pressed, false when released. Primary input for jumping, wall jumping, and various jump-based mechanics. Used with wasButtonJump for edge detection.
public bool buttonTaunt
Current frame's taunt button state. True when taunt/gesture button is pressed. Allows players to perform character-specific taunts, gestures, or victory poses. Adds personality to gameplay.
private float canFireDelay
Cooldown timer preventing immediate firing after certain actions. Set to 0.3 seconds after detonating remote car and 0.25 seconds after creating one. Blocks fire and special inputs while positive to prevent accidental double-actions.
protected bool climbButton
Climbing input state from AI controls. Used by enemy AI to control climbing behavior on ladders and walls.
public bool dashButton
Current frame's dedicated dash button state. Alternative to double-tap dashing, provides direct dash control. When pressed with direction, initiates ground or air dash based on character state.
public bool down
Current frame's down directional input state. True when down is pressed. Used for ducking, dropping through platforms, aiming downward, and sliding mechanics. Essential for defensive and movement options.
public bool fire
Current frame's state of the fire/shoot button input. Controls shooting mechanics, gun animations, and remote projectile control. Prevented during wall climbing, ladder use, or pushing.
protected float holdDownTime
Timer for forcing downward input. Field exists but no active usage found in current implementation.
protected float holdLeftTime
Timer for forcing leftward movement. Set to 0.3 seconds in certain conditions and forces left input while active. Decrements each frame when greater than 0.
protected float holdRightTime
Timer for forcing rightward input. Field exists but no active usage found in current implementation.
protected float holdStillTime
Timer that prevents or limits movement when active. Checked in multiple movement conditions and prevents certain actions. Decrements each frame when greater than 0.
protected float holdUpTime
Timer for forcing upward input. Field exists but no active usage found in current implementation.
protected float lastButtonJumpTime
Timestamp of the most recent jump button press. Used for jump buffering system - if player presses jump slightly before landing, jump executes upon touchdown. Creates more responsive controls.
public bool left
Current frame's left directional input state. True when left is pressed. Primary horizontal movement input for moving left. Combined with other inputs for dashing, wall climbing, and special moves.
protected float pressedJumpInAirSoJumpIfTouchGroundGrace
Grace period timer for jump input buffering while airborne. When jump is pressed in air, this timer counts down. If player lands while timer is positive, automatic jump occurs. Standard platformer quality-of-life feature.
public bool right
Current frame's right directional input state. True when right is pressed. Primary horizontal movement input for moving right. Combined with other inputs for dashing, wall climbing, and special moves.
public bool special
Current frame's state of the special ability button input. Cleared when acid-covered, in melee, dead, or controlled by AI. Used to trigger special abilities.
protected bool specialDown
Tracks if special button is currently pressed. Reset during initialization and various game states. Part of input state management system.
public bool sprint
Current frame's sprint modifier state. True when sprint/run button is held. Modifies movement speed when combined with directional inputs. May affect other actions like longer jumps or faster climbing.
public bool up
Current frame's up directional input state. True when up is pressed on D-pad, analog stick, or keyboard. Used for aiming upward, climbing ladders/walls, entering doors, and menu navigation.
protected bool wasButtonGesture
Previous frame's gesture button state. Used for edge detection to determine when the gesture button is first pressed.
public bool wasButtonHighFive
Previous frame's high-five button state. Enables edge detection for high-five activation, ensuring actions trigger on button press rather than hold. Prevents continuous high-five attempts.
public bool wasButtonJump
Previous frame's jump button state. Used with buttonJump to detect button press (false to true) and release (true to false) events. Essential for preventing jump spam and enabling precise jump control.
public bool wasButtonTaunt
Previous frame's taunt button state. Used for edge detection to trigger taunts on button press. Prevents continuous taunt animation while button is held, ensuring single taunt per press.
protected bool wasClimbButton
Previous frame's climb button state from AI controls. Used for edge detection of AI climbing inputs.
public bool wasdashButton
Previous frame's dash button state. Used for edge detection to trigger single dash per button press. Prevents continuous dashing while button is held, ensuring controlled dash execution.
public bool wasDown
Previous frame's down directional state. Used for detecting new down presses for actions like initiating duck, platform drops, or slides. Enables proper state transitions.
public bool wasFire
Previous frame's state of the fire button, used for edge detection. Triggers StartFiring() on press and StopFiring() on release, also used in death match invulnerability checks.
public bool wasLeft
Previous frame's left directional state. Critical for double-tap dash detection - tracks time between taps. Also used for detecting direction changes and state transitions in movement system.
public bool wasRight
Previous frame's right directional state. Critical for double-tap dash detection - tracks time between taps. Also used for detecting direction changes and state transitions in movement system.
public bool wasSpecial
Previous frame's state of the special button, used for edge detection. Compared with current special state to detect new button presses vs held inputs.
protected bool wasSpecialDown
Previous frame's special button state. Used for edge detection to identify button press and release events. Companion to specialDown for input tracking.
public bool wasSprint
Previous frame's sprint modifier state. Enables detection of sprint press/release for smooth speed transitions. Helps manage acceleration and deceleration in movement system.
public bool wasUp
Previous frame's up directional state. Enables detection of up press/release events. Used for initiating climbs, detecting input combinations, and preventing continuous up-triggered actions.
protected bool wasXBoxFireDown
Previous frame's Xbox controller fire button state. Field declared but no usage found in current implementation. Likely reserved for Xbox-specific input handling.
Environmental Interaction
Methods
protected virtual void AssignPushingTime()
Sets a brief timer when pushing blocks and cancels any rolling animation. Called when the character begins pushing a moveable block.
protected virtual bool CanCheckClimbAlongCeiling()
Checks if ceiling climbing mechanics should be evaluated by detecting nearby hanging points. Used to determine if the character can transition to ceiling hanging state.
Returns:
bool
: True if ceiling climbing should be checked (hanging points detected and not ducking/pressing down), false otherwise
protected virtual bool CanDoRollOnLand()
Determines whether the character should perform a roll when landing based on downward velocity.
Returns:
bool
: True if downward velocity exceeds -350 and rolling is allowed; otherwise, false.
public bool CanTouchCeiling()
Determines whether the character can interact with ceilings.
Returns:
bool
: True if the character can touch ceilings; otherwise, false.
protected virtual void CheckClimbAlongCeiling()
Handles ceiling climbing/hanging mechanics when transitioning from wall constraints. Performs upward raycasts to find ceiling attachment points and initiates hanging state when appropriate conditions are met.
protected virtual void CheckForCheckPoints()
Checks if character is touching checkpoints at current position or slightly above ground level. Calls ReachedCheckPoint if checkpoint contact is detected.
protected virtual void CheckForQuicksand()
Manages quicksand detection and transition effects. Tracks quicksand state changes, creates appropriate splash and particle effects on entry/exit, plays surface-specific sounds, and disables blast velocity while in quicksand.
protected virtual void CheckForQuicksandDeath()
Monitors for lethal quicksand submersion and applies crush damage after 2-second delay. Checks if character is deep in quicksand (16 units below surface) and deals fatal damage if choke counter exceeds threshold.
protected virtual void CheckForTraps(ref float yIT)
Comprehensive trap detection system. Checks for acid pools, barbed wire, spikes, and mines. Handles impalement, damage, and movement constraints from environmental hazards.
Parameters:
- float yIT: Y velocity reference that may be modified by trap interactions
protected virtual void CheckRescues()
Checks for nearby heroes to rescue and grants rescue bonuses. Provides invulnerability, shows start bubble, and adds brutality grace period.
protected virtual bool ConstrainToCeiling(ref float yIT)
Handles collision detection with ceilings and manages chimney flip mechanics when the character hits walls and ceilings simultaneously.
Parameters:
- out float yIT: Reference to the vertical movement delta that will be constrained.
Returns:
bool
: True if a ceiling constraint was applied; otherwise, false.
protected virtual bool ConstrainToFloor(ref float yIT)
Constrains the character's vertical movement to prevent falling through the floor, handling landing transitions and ground snapping.
Parameters:
- out float yIT: Reference to the vertical movement delta that will be constrained.
Returns:
bool
: True if the character was constrained to the floor; otherwise, false.
protected virtual void ConstrainToFragileBarriers(ref float xIT, float radius)
Handles collision and destruction of fragile barriers like doors and glass. Sends damage messages to break barriers on contact, creates visual effects at impact points, and handles special door opening mechanics for living players.
Parameters:
- out float xIT: Reference to horizontal velocity, may be modified if constrained by barrier
- float radius: The collision detection radius
protected virtual void ConstrainToMookBarriers(ref float xIT, float radius)
Prevents movement through enemy barriers while allowing friendly units to pass. Uses player numbers to determine if a barrier should block movement.
Parameters:
- out float xIT: Reference to horizontal velocity, set to 0 if blocked by enemy barrier
- float radius: The collision detection radius
protected virtual bool ConstrainToWalls(ref float yIT, ref float xIT)
Complex wall collision detection and constraint system that prevents the character from passing through walls and enables wall climbing. Performs multiple raycasts at different heights, handles wall climbing initiation, manages wall drag mechanics, and integrates with various movement systems including ledge grabbing and block pushing.
Parameters:
- out float yIT: Reference to vertical velocity, modified if wall climbing or dragging occurs
- out float xIT: Reference to horizontal velocity, modified if movement is constrained by walls
Returns:
bool
: True if the character was constrained by a wall, false otherwise
protected virtual void HitCeiling(RaycastHit ceilingHit)
Handles the character's response when hitting a ceiling, including position adjustment, sound effects, and potential transition to hanging state.
Parameters:
- RaycastHit ceilingHit: The raycast hit information for the ceiling collision.
protected virtual bool IsAboveLadder()
Checks if the character is positioned above a ladder by using Physics.OverlapSphere with a -1 unit vertical offset. Used for ladder grab detection from above.
Returns:
bool
: True if positioned above a ladder
public override bool IsInStealthMode()
Checks if the unit is in stealth mode by being crouched in grass. Requires the unit to be alive, crouching, player-controlled, standing still, and within grass.
Returns:
bool
: True if in stealth mode
protected virtual bool IsNearbyLadder(float xOffset, float yOffset)
Checks if a ladder is nearby at the specified offset position. Used for proximity-based ladder detection in various movement states.
Parameters:
- float xOffset: Horizontal offset from character position
- float yOffset: Vertical offset from character position
Returns:
bool
: True if a ladder is detected at the offset position
protected bool IsOverFinish(ref float ladderXPos)
Comprehensive victory zone detection that checks if the character has reached the level finish area. Handles helicopter attachment, portal exits, level completion triggers, and applies appropriate invulnerability and state changes for level completion.
Parameters:
- out float ladderXPos: Reference to ladder X position, modified if attaching to helicopter
Returns:
bool
: True if the character is in the finish/victory zone
protected virtual bool IsOverLadder(float xOffset, ref float ladderXPos)
Checks if the character is positioned over a ladder. Resets jump-related timers and manages ladder block notifications when on a ladder.
Parameters:
- out float ladderXPos: Outputs the X position of the detected ladder
Returns:
bool
: True if positioned over a ladder
protected virtual bool IsOverLadder(float xOffset, ref float ladderXPos)
Checks if the character is over a ladder with a horizontal offset. Handles ladder detection, jump timer resets, double jump management, and ladder block entry/exit notifications. Tracks current and previous ladder blocks for state management.
Parameters:
- float xOffset: Horizontal offset for ladder detection
- out float ladderXPos: Outputs the X position of the detected ladder
Returns:
bool
: True if a ladder is detected at the offset position
protected override bool IsSubmergedInPool()
Extended submersion detection that treats quicksand and oil as equivalent to pool submersion. Overrides base class functionality by combining base pool detection with quicksand and oil state checks using logical OR operation.
Returns:
bool
: True if character is submerged in pool, quicksand, or oil; false otherwise
protected bool IsSurroundedByBarbedWire()
Checks if character is surrounded by barbed wire that can cause damage during movement.
Returns:
bool
: True if surrounded by damaging barbed wire, false otherwise
protected virtual bool IsWithinGrass()
Checks if the unit is inside grass or substance on both sides. Tests positions 5 units to the left and right of the character.
Returns:
bool
: True if grass is detected on both sides
protected virtual void Land()
Comprehensive landing handler that processes all aspects of ground contact including state resets, damage calculation, visual effects, platform interactions, and sound effects.
public void LandInOil()
Initializes oil effect materials and applies them to both character and gun sprites. Creates oily materials using "Unlit/Depth Cutout With Image - Oily" shader with lazy instantiation pattern. Sets up UV2 coordinates and configures sprite size vectors for proper oil effect rendering.
public void LeaveOil()
Placeholder method for leaving oil areas. Actual oil cleanup logic is handled by the continuous RunHasLeftOilTest method which manages gradual oil level decay and material restoration.
protected virtual void LedgeGrapple(bool left, bool right, float radius, float heightOpenOffset)
Handles ledge grabbing mechanics when the character is near an edge while jumping or falling. Initiates ledge grab state when conditions are met and adjusts character position for proper alignment.
Parameters:
- bool left: Whether the character is moving left
- bool right: Whether the character is moving right
- float radius: The horizontal detection radius for ledge detection
- float heightOpenOffset: The vertical offset for ledge height calculation
protected virtual void PickupPickupables()
Attracts nearby pickupable items when character is alive. Uses attraction radius to automatically collect items within range.
public virtual bool PushGrassAway()
Pushes grass away from the unit and plays appropriate environmental sounds. Performs raycasts to find ground blocks, applies forces to jiggle doodads. Plays different sounds for grass versus blood pools based on doodad type.
Returns:
bool
: True if any grass was pushed away
protected virtual void ReachedCheckPoint()
Virtual method called when character reaches a checkpoint. Empty implementation that can be overridden by derived classes.
protected virtual void RollOnLand()
Initiates the rolling animation sequence when landing with sufficient velocity, setting the character to rolling state for 13 frames.
protected virtual void RunBlindStars()
Creates periodic blind star visual effects around blinded characters. Spawns shrapnel stars above character head with randomized positioning.
protected virtual void RunClimbingLadder()
Handles all ladder climbing physics and movement logic, including vertical movement based on input, horizontal positioning, and exit conditions.
protected void RunHasLeftOilTest()
Manages gradual oil level decay and material transitions when leaving oil areas. Decreases oil level over time using deltaTime, updates material opacity properties, and handles cleanup by restoring original materials when oil level reaches zero.
protected virtual void RunZombieEffects()
Handles ongoing zombie revival visual effects. Creates periodic zombie passive effects with random timing intervals.
protected virtual void StartHanging()
Initiates the ceiling hanging state if the character is not ducking.
protected virtual void StopHanging()
Transitions the character from hanging state to jumping state.
protected virtual void StopRolling()
Ends the rolling state by setting the character to idle or running based on current input.
Properties
public bool WallClimbing { get; set; }
Gets a value indicating whether the character is currently climbing a wall.
protected virtual bool WallDrag { get; set; }
Gets or sets a value indicating whether the character is sliding down a wall. Setting this property manages wall drag audio effects, knife climbing state, and parachute deactivation.
Fields
protected bool armUpInAnticipationWallClimb
Controls arm position during wall climb anticipation. When true, displays the character with arm raised (frame offset +1) in preparation for wall climbing. Provides visual feedback that the character is ready to climb.
protected LayerMask barrierLayer
LayerMask defining mobile barriers for collision. Set to "MobileBarriers" layer. Used for specialized mobile obstacle detection.
public BossBlockPiece bossBlockPieceCurrentlyStandingOn
Special reference for boss block platforms. Set via GetComponent when landing on boss blocks. Calls StandingOnBlock each frame and LandOn when landing with velocity.
public bool breakDoorsOpen
Determines damage type when hitting doors. When true, sends DamageType.Crush to doors. When false, sends DamageType.Melee. Modifies door destruction behavior on collision.
public bool canChimneyFlip
Enables chimney flip ability - jumping between two close walls. When true, character can perform wall jumps in narrow vertical spaces. Provides advanced movement option for certain characters. Currently not actively used in the base implementation.
public bool canLedgeGrapple = true
Determines if this character can grab and hang from ledges. Default true allows standard ledge grappling behavior. Set to false for characters that should fall instead of grabbing ledges. Checked during collision detection with ledges.
public LadderBlock currentLadderBlock
Reference to the ladder block character is currently on. Used to track state transitions between ladders and calls OnBroExit when leaving a ladder.
protected LayerMask fragileLayer
LayerMask defining fragile/destructible objects. Set to "DirtyHippie" layer. Combined with ground and platform layers for composite ground detection including destructible terrain.
protected LayerMask groundLayer
LayerMask defining which layers are considered solid ground for collision detection. Includes "Ground", "LargeObjects", and "IndestructibleGround" layers. Primary layer for floor, ceiling, and wall collision detection throughout the movement system.
protected Transform groundTransform
Reference to current ground or platform standing on. Set in AssignGround when landing and used as part of parenting system for moving platforms. Reset to null in ShiftUnitWithParent.
protected Vector3 groundTransformLocalPos
Local position on ground or platform. Set in AssignGround with different calculation for Tank vs normal ground. Returned by GetParentedToPos when grounded.
protected bool isInOil
Whether character is covered in oil. Set by LandInOil method and applies visual oil shader effect. Automatically clears when oilLevel reaches 0.
protected bool isInQuicksand
Whether character is currently in quicksand. Applies 0.4x speed multiplier, 3x slower animation rate, prevents air dashing, and can cause death if submerged for 2+ seconds.
protected float knifeClimbStabHeight = 18f
Vertical distance in units between knife stab animations during wall climbing. Default value of 18 units creates a rhythmic stabbing pattern as the character climbs. Works with lastKnifeClimbStabY to trigger stab effects at regular intervals.
protected int ladderClimbingTransitionFrames
Counter for ladder mounting/dismounting transition animation. Decrements each frame while playing transition animation. When it reaches 0, normal ladder climbing begins. Provides smooth visual transition onto ladders.
protected LayerMask ladderLayer
LayerMask defining climbable ladder objects. Set to "Ladders" layer. Core to climbing mechanics with extensive use in ladder detection methods like IsOverLadder and FindNearbyLadder.
protected float ladderX
Stores X position of current ladder for alignment. Set by IsOverLadder methods when ladder is detected. Used to align character to ladder position and passed to AttachToHelicopter for rope ladders.
protected float lastKnifeClimbStabY
Stores the Y position of the last knife stab during wall climbing. Used to determine when to play the next stab animation and sound effect. Stabs occur every knifeClimbStabHeight units of vertical movement to create rhythmic climbing feedback.
protected RaycastHit newRaycastHit
Secondary raycast storage for complex collision checks. Used exclusively in chimney flip detection logic, allowing nested raycast checks without overwriting the main raycastHit.
protected float oilLevel
Amount of oil coverage on character from 0 to 1. Increases by 0.01 when landing in oil and decreases by 1 per second. Controls oil shader intensity.
protected LayerMask openDoorsLayer
LayerMask defining interactive doors and movable objects. Set to "Movetivate" layer. Used for door collision checks at high speed and triggers damage/opening mechanics. Excludes parachute objects.
protected LayerMask platformLayer
LayerMask defining layers that act as platforms (can stand on but pass through from below). Set to "Platform" layer. Often combined with groundLayer for comprehensive ground detection.
private LadderBlock prevLadderBlock
Tracks previous ladder block for state management. Stores previous ladder before updating current and ensures OnBroExit is called on the previous ladder when switching. Prevents duplicate exit calls.
protected float quicksandChokeCounter = 2f
Timer until quicksand kills the character. Initialized to 2 seconds. Reset to 0 when entering quicksand and increments while head is submerged. Character dies when counter reaches 2.
protected RaycastHit raycastHit
Primary storage for Physics.Raycast results. Reused throughout for ground detection, wall checks, ceiling checks, and damage application. Stores hit point, normal, distance, and collider information.
protected RaycastHit raycastHitWalls
Stores raycast results for wall collision detection. Extensively used in ConstrainToWalls for collision detection at multiple heights, ledge grabbing, footstep sounds, and wall transform assignment.
protected LayerMask switchesLayer
LayerMask likely intended for interactive switches and triggers. Not initialized or used in TestVanDammeAnim base implementation.
protected LayerMask victoryLayer
LayerMask defining level completion/victory trigger areas. Set to "Finish" layer. Used in IsOverFinish method to detect when player reaches level completion zones.
protected bool wallClimbAnticipation
Tracks whether the character is in wall climb anticipation state. When true, the character is preparing to climb and may show anticipation animations. Used to coordinate the wall climbing animation sequence before actual climbing begins.
protected bool wasInQuicksand
Tracks previous frame's quicksand state for edge detection. Compared with isInQuicksand to detect when character enters or exits quicksand.
Audio System
Methods
public virtual bool CanLaugh()
Checks if character can play laughter sounds based on available sound assets.
Returns:
bool
: True if laugh sounds are available, false otherwise
public virtual void PlayAttack2Sound(float volume = 0.35f)
Plays secondary attack sound effect for special combat actions.
Parameters:
- float volume: Volume level for the sound effect (default 0.35)
public virtual void PlayAttack3Sound(float volume = 1f)
Plays tertiary attack sound effect for advanced combat actions.
Parameters:
- float volume: Volume level for the sound effect (default 1.0)
public virtual void PlayAttack4Sound(float volume = 1f, float pitch = 0.9f)
Plays quaternary attack sound effect with custom volume and pitch settings.
Parameters:
- float volume: Volume level for the sound effect (default 1.0)
- float pitch: Base pitch modifier (default 0.9)
protected virtual void PlayAttackSound(float v)
Plays primary attack sound effect with default volume (0.3).
protected virtual void PlayAttackSound(float v)
Plays primary attack sound effect with specified volume.
Parameters:
- float v: Volume level for the sound effect
public virtual void PlayAttractedSound()
Plays attraction sound effect when character is attracted to or influenced by external forces.
public virtual void PlayBassDropShortSound()
Plays shortened bass drop sound effect with higher volume and 0.3 second cooldown.
public virtual void PlayBassDropSoundSound()
Plays bass drop sound effect for dramatic moments with 0.3 second cooldown.
protected virtual void PlayBleedSound()
Plays a bleeding sound effect when the character bleeds. Uses a fixed volume of 0.45 with no pitch variation.
protected virtual void PlayBurnSound(float v)
Plays burning/fire damage sound effect with randomized pitch. Lazy loads the sound instance on first use and plays from the burn sound array with pitch varying between 0.6 and 1.0 for variety.
Parameters:
- float v: Volume level for the sound effect
public void PlayChestBurstSound(float pitch)
Plays alien chest burst sound effect at character position with specified pitch.
Parameters:
- float pitch: Pitch modifier for the sound effect
public virtual void PlayChimneyFlipSound(float volume)
Plays chimney flip sound effect by calling the dash sound method.
Parameters:
- float volume: Volume level for the sound effect
public virtual void PlayChokeSound()
Plays choking sound effect with randomized pitch variation for suffocation or strangulation.
protected virtual void PlayClimbSound()
Plays sound effect for general climbing actions (reuses jump sound).
public virtual void PlayConfusedSound()
Plays confused sound effect for disoriented character states.
public void PlayDashSound(float volume)
Plays dashing movement sound effect with specified volume.
Parameters:
- float volume: Volume level for the sound effect
protected virtual void PlayDeathGargleSound()
Plays a death gargle sound effect during character death. Uses pitch shift for variation at 0.45 volume.
protected virtual void PlayDeathSound()
Plays death sound effects with volume adjusted based on sound availability. Reduces volume to 50% if no hit sounds are available.
protected virtual void PlayDecapitateSound()
Plays a dismemberment sound effect when the character is decapitated. Uses a fixed volume of 0.5 with no pitch variation.
public virtual AudioSource PlayDizzieSound(float volume = 0.33f, float pitch = 1f)
Plays dizzy/stunned sound effect with pitch randomization in ±0.05 range plus character-specific pitch shift for natural variation.
Parameters:
- float volume: Volume level for the sound effect (default 0.33)
- float pitch: Base pitch value with ±0.05 random variation applied (default 1.0)
Returns:
AudioSource
: AudioSource component playing the sound
protected virtual void PlayExitLadderSound()
Plays sound effect for exiting a ladder (reuses jump sound).
protected virtual void PlayFallDamageSound(float v)
Plays a fall damage impact sound effect. Convenience method that calls the overloaded version with 0.4 volume.
protected virtual void PlayFallDamageSound(float v)
Plays a fall damage impact sound effect with specified volume. Used when the character takes damage from falling.
Parameters:
- float v: Volume for the sound effect
public virtual AudioSource PlayFallSound(float v = 0.3f)
Plays a falling or air movement sound effect. Returns the AudioSource to allow external manipulation of the playing sound.
Parameters:
- float v: Volume for the sound effect (default 0.3)
Returns:
AudioSource
: The AudioSource playing the fall sound
protected virtual void PlayFizzleSound(float v)
Plays acid/chemical damage sound effect with slight pitch variation. Lazy loads the sound instance on first use and plays from the fizzle sound array with pitch between 0.95 and 1.05 for subtle variety.
Parameters:
- float v: Volume level for the sound effect
public virtual void PlayFlexSound(float volumne)
Virtual method for playing flex sound. Empty implementation that can be overridden by derived classes.
Parameters:
- float volumne: Volume level for the sound effect (note: parameter name has typo)
protected virtual void PlayFootStepSound(float v, float p)
Core footstep sound playing method with player versus NPC audio optimization. Players hear full volume while NPCs play at 50% volume and only when visible on screen. Includes footstep delay gating to prevent audio spam.
Parameters:
- AudioClip[] clips: Array of audio clips to randomly select from for footstep sound
- float v: Volume level for the footstep sound
- float p: Pitch level for the footstep sound
public virtual void PlayFreezeScreamSound()
Plays freeze scream sound effect with randomized pitch variation when character is frozen.
protected virtual void PlayGibSound()
Plays gibbing sounds with variation based on frozen state. Plays frozen gib sounds if the character is frozen, otherwise plays normal death sounds.
public virtual void PlayGreetingSound()
Plays greeting sound effect for character interactions and high-five initiations.
public virtual void PlayHighFiveSound()
Plays high-five celebration sound with 0.3 second cooldown to prevent spam.
protected virtual void PlayHitSound(float v = 0.4f)
Plays hit reaction sounds with conditional logic based on health state. If alive and hurt sounds are available, plays hurt sound with a 0.1 second cooldown. Otherwise plays effort sounds. Scales volume to 0.37 for hurt sounds.
Parameters:
- float v: Base volume for the sound effect (default 0.4)
protected virtual void PlayHurtSound(float v = 0.3f)
Directly plays a hurt sound effect when the character takes damage. Updates the last hit sound time to enforce cooldown between hurt sounds.
Parameters:
- float v: Volume for the sound effect (default 0.3)
protected virtual void PlayJumpSound()
Plays appropriate jumping sound based on current ground surface type. Uses identical surface detection logic as landing sounds but with jump-specific audio variants. Plays at slightly higher volume (0.65f) compared to landing sounds.
protected virtual void PlayKnifeClimbSound()
Plays knife climbing sound effects with automatic variation cycling. Increments sound counter and uses modulo operation to cycle through available knife wall sounds. Plays at 0.2f volume and 1f pitch with 3D positioning.
protected virtual void PlayLandSound()
Plays appropriate landing sound based on current ground surface type. Supports six surface types (Dirt, Stone, Metal, Wood, Grass, Slime) with corresponding sound arrays. All landing sounds play at 0.6f volume and 1f pitch.
public virtual void PlayLaughterSound()
Plays laughter sound effect with 2-second cooldown to prevent spam. Used for character celebration and reactions.
public virtual void PlayMuffledScreamsSound()
Plays muffled screams sound effect typically used during alien face hugger attacks.
public virtual void PlayPanicSound()
Plays panic sound effect with randomized pitch variation for distressed character states.
public void PlayPowerUpSound(float volume, float pitch)
Plays power-up sound effect with specified volume and default pitch.
Parameters:
- float volume: Volume level for the sound effect
public void PlayPowerUpSound(float volume, float pitch)
Plays power-up sound effect with specified volume and pitch settings.
Parameters:
- float volume: Volume level for the sound effect
- float pitch: Pitch modifier for the sound effect
public virtual void PlayPushBlockSound()
Virtual method for playing block pushing sound. Empty implementation that can be overridden by derived classes.
public virtual void PlayResurrectionSound(float volume = 0.3f)
Plays resurrection sound effect with 2-second cooldown when character is revived or respawns.
Parameters:
- float volume: Volume level for the sound effect (default 0.3)
protected virtual void PlayRollLandSound()
Plays the appropriate landing sound effect when completing a roll, with volume based on impact velocity.
public virtual void PlaySpecial2Sound(float volume, float pitch)
Plays special ability 2 sound effect with specified pitch. Default overload that calls the volume/pitch variant.
Parameters:
- float pitch: Pitch modifier for the sound effect
public virtual void PlaySpecial2Sound(float volume, float pitch)
Plays special ability 2 sound effect with custom volume and pitch settings.
Parameters:
- float volume: Volume level for the sound effect
- float pitch: Pitch modifier for the sound effect
public virtual AudioSource PlaySpecial3Sound(float v, float pitch)
Plays special ability 3 sound effect with specified volume and default pitch.
Parameters:
- float v: Volume level for the sound effect
Returns:
AudioSource
: AudioSource component playing the sound
public virtual AudioSource PlaySpecial3Sound(float v, float pitch)
Plays special ability 3 sound effect with custom volume and pitch settings.
Parameters:
- float v: Volume level for the sound effect
- float pitch: Pitch modifier for the sound effect
Returns:
AudioSource
: AudioSource component playing the sound
public virtual void PlaySpecial4Sound(float v)
Plays special ability 4 sound effect with specified volume.
Parameters:
- float v: Volume level for the sound effect
public virtual void PlaySpecialAttackSound(float v)
Plays special attack sound effect with specified volume.
Parameters:
- float v: Volume level for the sound effect
public virtual void PlaySpecialSound(float volume, float pitch)
Plays special ability sound effect with default volume (0.8) and pitch (1.0).
public virtual void PlaySpecialSound(float volume, float pitch)
Plays special ability sound effect with specified volume and default pitch.
Parameters:
- float volume: Volume level for the sound effect
public virtual void PlaySpecialSound(float volume, float pitch)
Plays special ability sound effect with full control over volume, pitch, and reverb settings.
Parameters:
- float volume: Volume level for the sound effect
- float pitch: Pitch modifier for the sound effect
- bool bypassReverb: Whether to bypass environmental reverb effects
public virtual void PlaySpecialSound(float volume, float pitch)
Plays special ability sound effect with specified volume and pitch.
Parameters:
- float volume: Volume level for the sound effect
- float pitch: Pitch modifier for the sound effect
public virtual void PlayStunnedSound()
Plays stunned sound effect by calling the dizzy sound method with default parameters.
public virtual void PlayThrowHeavySound(float v)
Plays heavy throwing sound effect for objects like heavy weapons or large items.
Parameters:
- float v: Volume level for the sound effect
public virtual void PlayThrowLightSound(float v)
Plays light throwing sound effect for objects like grenades or light weapons.
Parameters:
- float v: Volume level for the sound effect
public virtual void PlayYeahSound(float volume, float pitch, bool bypassReverb)
Plays celebration "yeah" sound effect with specified volume. Delegates to power-up sound system.
Parameters:
- float volume: Volume level for the sound effect
public virtual void PlayYeahSound(float volume, float pitch, bool bypassReverb)
Plays celebration "yeah" sound effect with full control over volume, pitch, and reverb. Delegates to power-up sound system.
Parameters:
- float volume: Volume level for the sound effect
- float pitch: Pitch modifier for the sound effect
- bool bypassReverb: Whether to bypass environmental reverb effects
protected virtual void PlayZappedSound(float v = 0.25f)
Plays an electrical zapping sound effect when the character is electrocuted. Uses randomized pitch between 0.95 and 1.05 for variation.
Parameters:
- float v: Volume for the sound effect (default 0.25)
protected virtual void RunWallDraggingAudio()
Manages wall dragging audio effects for heroes with wall climb ability. Adjusts pitch and volume based on climbing state and vertical velocity.
protected void SetCurrentFootstepSound(Collider collider)
Updates the current footstep sound type based on the ground collider's tag, but only if a footstep sound holder exists and the collider has a tag other than "Untagged".
Parameters:
- Collider collider: The ground collider the character is touching.
Properties
public bool ShowGesturesMenu { get; set; }
Gets a value indicating whether the gestures menu should be displayed. Always false because the Gestures Menu is unimplemented.
Fields
private float _lastLaughterSoundTime
Timestamp of the last laughter/taunt sound played. Used to prevent laughter sound spam by enforcing a minimum 2-second delay between plays. Manages audio cooldown for character taunts and victory sounds.
private float _lastResurectionSoundTime
Timestamp of the last resurrection sound played. Used to prevent resurrection sound spam by enforcing a minimum 1-second delay between plays. Ensures audio doesn't overlap during rapid revival attempts.
protected string currentFootStepGroundType = string.Empty
Current terrain type string for footstep sound selection. Set from collider tags and used to select appropriate footstep sounds. Reset to empty when leaving ground.
protected float footstepDelay = 0.5f
Controls footstep sound timing with a default 0.5 second delay. Decrements each frame and must reach 0 before another footstep sound can play.
protected int knifeSoundCount
Cycles through knife climbing sound variations. Incremented with each knife climb action and used with modulo to select from sound array for audio variety.
protected static float lastBassTime
Global static cooldown for bass drop sound effects. Prevents bass drop sounds within 0.3 seconds of each other. Used for special announcer-style bass effects.
protected GroundType lastFootStepGroundType = GroundType.BrickBehind
Stores previous ground type for footstep sound system. Initialized to GroundType.BrickBehind as the default terrain type.
protected static float lastHighFiveTime
Global static cooldown for high-five sound effects. Ensures minimum 0.3 second delay between high-five sounds across all instances to prevent audio overlap.
protected float longGrassDelay = 0.15f
Minimum delay between long grass sound effects in seconds. Default value of 0.15 seconds prevents grass sound spam when moving through vegetation.
protected float longGrassDelayTimer
Tracks time until next grass sound can play. Decrements each frame and is reset to longGrassDelay when a grass sound plays.
protected Sound sound
Primary audio system interface for all character sound effects including footsteps, attacks, death sounds, special abilities, and environmental sounds. Lazy initialized if null.
public SoundHolder soundHolder
Container for general sound effects used by the character. Stores various audio clips for actions like shooting, jumping, and taking damage.
public SoundHolderFootstep soundHolderFootSteps
Container specifically for footstep and movement-related sounds. Includes wallDragLoops array used for wall sliding audio effects.
protected AudioSource wallDragAudio
Audio source for wall sliding sound effects. Created on demand when wall climbing and plays looping drag sounds. Volume and pitch adjusted based on slide speed.
Unit Management
Methods
private float AttachToHelicopter(float ladderXPos, Helicopter helicopter)
Attaches the character to a helicopter for level exit sequences. Adds the hero to the helicopter's attached list, parents the character to the ladder holder, positions them relative to the helicopter, and adjusts facing direction.
Parameters:
- float ladderXPos: The ladder X position reference
- Helicopter helicopter: The helicopter instance to attach to
Returns:
float
: Updated ladder X position after attachment
public override void DischargePilotingUnit(float newX, float newY, float xI, float yI, bool stunPilot)
Exits piloting mode and restores character to normal state. Re-enables rendering, restores health, sets position/velocity, and optionally applies stun effects.
Parameters:
- float newX: X position to place character after discharge
- float newY: Y position to place character after discharge
- float xI: X velocity to apply after discharge
- float yI: Y velocity to apply after discharge
- bool stunPilot: Whether to stun the character after discharge
public override Unit GetPilottedUnit()
Gets the unit currently being piloted by this character.
Returns:
Unit
: The piloted unit, or null if not piloting anything
private void GrabHelicopterLadder()
Placeholder method for grabbing the helicopter ladder. Currently has no implementation but serves as a virtual method hook for derived classes.
public override void StartPilotingUnit(Unit pilottedUnit)
Initiates piloting mode by disabling character rendering and controls while transferring control to specified unit. Sets health to 10000, enables invulnerability, and stops UI bubbles.
Parameters:
- Unit pilottedUnit: The unit this character will pilot
Properties
public ReactionBubble playerBubble { get; set; }
Gets the ReactionBubble instance appropriate for this player's number. Returns the corresponding bubble UI element based on the player's assigned number.
Fields
protected bool broMustFailToWin
Marks bros that must fail or die to satisfy certain win conditions. When true, disables normal gibbing (sets canGib false) and only allows death from OutOfBounds damage. Used for special game modes or scenarios.
private bool ElgilbleToBeKicked
Whether this player can be kicked by teammates for being idle. Set true after 15 seconds of no input with 2+ players. Reset to false on any input. Note: Field name contains typo (should be "Eligible").
private bool hasBeenKicked
Tracks whether the unit has been kicked by another character. Set to true in KickRPC when kick is received. Prevents duplicate kick processing and triggers kick animation and bubble display.
public Grenade heldGrenade
Reference to grenade currently held by character for throwing back. Enables grenade catch-and-throw mechanics. Used to calculate throw velocity based on grenade weight.
public Mook heldMook
Reference to enemy (Mook) currently held by character. Enables enemy grab-and-throw mechanics. Position updates applied to held mook during carry.
public bool isOnHelicopter
Indicates whether the hero has boarded the extraction helicopter at level completion. Set to true when entering helicopter, changes playerNum to 5 for special handling. Used to track successful level extraction.
private ReactionBubble kickPlayerBubble
Visual indicator shown above idle players that can be kicked by teammates. Changes material/color based on kick state. Only appears in multiplayer with 2+ players after 15 seconds of inactivity.
private float lastPathingTime
Timestamp of last AI pathfinding attempt. Enforces 0.1 second cooldown between pathfinding requests to prevent excessive calculations.
protected Mook nearbyMook
Reference to closest enemy available for interaction. Set to skinned mook on back if present, otherwise searches for nearby mook. Used for grab/interaction targeting.
public TestVanDammeAnim onBackOf
Reference to another unit this unit is riding on (piggyback riding). Used for special movement mechanics when one character carries another.
private int pathingAttempts
Counter for AI pathfinding attempts. Incremented on each attempt and stops trying after 10 attempts to prevent infinite loops. Reset when command completes.
public Unit pilottedUnit
Reference to the vehicle or unit currently being piloted by this character. Set when entering vehicles, cleared when exiting. When set, modifies UI display and input handling. Serialized for network synchronization.
protected bool throwingHeldObject
Indicates if character is currently in throwing animation. Set true when starting throw and false when completed. Controls throwing animation state.
Helper & Utility
Methods
protected virtual void ActivateGun()
Shows the gun sprite by setting it active. Counterpart to DeactivateGun, used to restore weapon visibility after states that hide it. Includes null check for safety.
public virtual float CalculateCeilingHeight()
Calculates the height of the ceiling above the character using three upward raycasts (center, left, right). Returns the lowest ceiling point found, which is used for death animations to prevent visual clipping through level geometry.
Returns:
float
: Height in units to the nearest ceiling above the character
protected virtual bool CanReduceLives()
Determines whether lives should be reduced when this character dies. Returns true for non-zombie characters, allowing normal life deduction. Zombie characters return false to prevent life loss on death.
Returns:
bool
: True if lives should be reduced on death, false for zombies
protected virtual void DeactivateGun()
Hides the gun sprite by setting it inactive. Used during death sequences, frozen states, and other situations where the weapon should not be visible. Includes null check for safety.
protected virtual BloodColor GetFootPoofColor()
Determines appropriate particle effect color based on environmental ground conditions. Uses priority-based detection: oil takes precedence over quicksand, which takes precedence over pool submersion. Returns BloodColor.None for normal ground.
Returns:
BloodColor
: BloodColor enum value representing the appropriate particle effect color for current environment
protected virtual void NotifyDeathType()
Reports the character's death type to the statistics system for analytics tracking. Uses an internal flag to ensure the death is only reported once, preventing duplicate statistics entries.
public override UnityStream PackState(UnityStream stream)
Serializes character state for network synchronization. Packs piloted unit, action state, and health. For heroes, also includes player number and hero type.
Parameters:
- UnityStream stream: The network stream to write data to
Returns:
UnityStream
: The stream with packed data
private void RunOnlineBadSpawnFailSafe()
Prevents bad spawn situations in online multiplayer for hero characters. Runs periodic checks to ensure proper spawn state when not hosting.
protected virtual void SetGunPosition(float xOffset, float yOffset)
Positions the gun sprite relative to the character with specified offsets. Sets gun transform position and ensures consistent scale (1,1,1) while maintaining proper rendering depth (-0.001f on Z-axis).
Parameters:
- float xOffset: Horizontal offset for gun positioning relative to character
- float yOffset: Vertical offset for gun positioning relative to character
private void SetRenderers(bool enabled)
Toggles all child MeshRenderer components on or off. Finds all MeshRenderers in children including inactive ones and sets their enabled state.
Parameters:
- bool enabled: Whether to enable or disable the renderers
protected void StopPlayerBubbles()
Deactivates all player indicator UI bubbles including player number bubbles (1-4) and the high-five interaction bubble. Only runs for player-controlled characters and calls StopBubble on each active bubble to hide them.
protected void TryAssignHeroThatKilledMe(MonoBehaviour damageSender)
Tracks which hero killed this unit for statistics and scoring purposes. Only assigns if not already set, extracts the player number from the damage sender, and stores the death position for kill tracking statistics.
Parameters:
- MonoBehaviour damageSender: The MonoBehaviour (typically a hero) that killed this unit
public override UnityStream UnpackState(UnityStream stream)
Deserializes network state and applies it to the character. Unpacks all data from PackState with special handling for BoondockBro and Desperabro. Sets up hero if alive or deactivates gun if dead.
Parameters:
- UnityStream stream: The network stream to read data from
Returns:
UnityStream
: The stream after reading data
Properties
public float HalfWidth { get; set; }
Gets the half-width of the character's collision bounds. This value is used for collision detection and positioning calculations.
public Transform SyncParent { get; set; }
Gets or sets the parent Transform for network synchronization. This property enables synchronized parenting across multiplayer clients.
public ParentedPosition SyncParentedPosition { get; set; }
Gets or sets the position relative to a parent Transform for network synchronization. This property manages both position and parent relationship in multiplayer scenarios.
Fields
public float _counter
General purpose time counter field. Currently has no specific usage in TestVanDammeAnim base implementation. Available for derived classes to use for custom timing needs or animation sequences.
private float _spawnFailSafeTimer
Network synchronization failsafe timer for spawn validation. Counts up for 2 seconds after spawning to detect position mismatches in multiplayer. If position remains at origin after timeout, triggers forced position sync to resolve spawn failures.
Character Setup & Configuration
Methods
public virtual void AttachToHeli()
Virtual method for attaching TestVanDammeAnim to helicopter. Currently empty implementation that can be overridden by derived classes.
public void SetUpHero(int PlayerNum, HeroType heroTypeEnum, bool registerHero)
Configures TestVanDammeAnim as a hero character with specified player number and hero type. Optionally registers with HeroController and creates hero indicator effects based on game state conditions.
Parameters:
- int PlayerNum: The player number to assign to this hero (0-3)
- HeroType heroTypeEnum: The type of hero this character represents
- bool registerHero: Whether to register this hero with the HeroController system
public void ShowStartBubble()
Displays the starting bubble UI for heroes when HUDs are enabled and character is alive. Restarts bubble animation and flashes avatar.
Fields
public Material disarmedGunMaterial
Material applied to gun sprite to indicate disarmed state during reward phase. Only applied to non-winning players in multiplayer matches. Provides visual feedback that the character's weapon is disabled.
public SpriteSM faderSpritePrefab
Prefab reference for creating fade effect sprites. Used to access FaderSprite component for visual fade transitions. Enables smooth visual transitions for various game states.
public HeroType heroType
Identifies which specific hero character this instance represents (e.g., Rambro, Brominator). Set during hero setup and used for death statistics, special behaviors, and network serialization. Critical for hero registration and ability configuration.
public Player player
Reference to the Player object that controls this hero. Core reference for input handling, player-specific settings, and multiplayer identification. Essential for connecting character actions to player input.
public bool spawnPositionHasBeenSet
Flag indicating the unit's spawn position has been properly initialized. Set to true after spawn setup completes. Prevents duplicate spawn initialization and ensures spawn-related effects only trigger once.
public bool usePrimaryAvatar = true
Determines whether to display the primary or secondary avatar image in the HUD. Default true shows primary avatar. Passed to all avatar state methods to control which character portrait is displayed. Can be toggled for alternate character representations.
Alien Infection System
Methods
public virtual void BurstChest()
Executes alien chest bursting sequence. Disconnects face hugger, spawns alien xenomorph (only for local player or local insemination), targets nearest player, triggers alien growth, gibs character, and plays sound effects.
protected int CalculateInseminationFrame()
Calculates the sprite frame for insemination animation based on infection progression. Returns frames 0-7 based on inseminated counter timing.
Returns:
int
: Animation frame index for insemination state
public override bool CanInseminate(float xI, float yI)
Checks if character can be inseminated by alien face huggers. Requires no existing inseminator, positive health, and health below 1000.
Parameters:
- float xI: X force component (unused in logic)
- float yI: Y force component (unused in logic)
Returns:
bool
: True if character can be inseminated, false otherwise
public void DisConnectFaceHugger()
Removes attached face hugger from character. Handles face hugger positioning, disconnection, and UI cleanup.
public bool HasFaceHugger()
Checks if character currently has a face hugger attached.
Returns:
bool
: True if face hugger is attached, false otherwise
public override bool Inseminate(AlienFaceHugger unit, float xForce, float yForce)
Initiates alien insemination process via RPC for network synchronization. Called by face hugger units to begin infection.
Parameters:
- AlienFaceHugger unit: The alien face hugger performing the insemination
- float xForce: X force component for insemination
- float yForce: Y force component for insemination
Returns:
bool
: Always returns true
protected void InseminateRPC(AlienFaceHugger unit, float xForce, float yForce)
RPC method that executes alien insemination process. Sets up face hugger attachment, initializes infection counters, updates UI, and plays muffled scream sounds.
Parameters:
- AlienFaceHugger unit: The alien face hugger performing insemination
- float xForce: X force component for insemination
- float yForce: Y force component for insemination
public bool IsInseminated()
Checks if character is currently in inseminated state with active alien infection.
Returns:
bool
: True if inseminated with alien parasite, false otherwise
public override void RecoverFromInsemination()
Initiates recovery from alien insemination via RPC for network synchronization. Called to cure infection before chest bursting occurs.
protected void RecoverFromInseminatioRPC()
RPC method that executes insemination recovery. Removes face hugger, resets infection counters, grants invulnerability, and cleans up UI elements.
Fields
public Unit alienBursterPrefab
Prefab reference for the alien creature that bursts from the unit's chest after insemination. Spawned when inseminatedCounter reaches its threshold, creating the dramatic chest-bursting death sequence. The spawned alien becomes an enemy unit.
private bool inseminatedByLocalUnit
Tracks whether the insemination was performed by a locally-controlled unit. Currently not actively used in the codebase. May have been intended for network synchronization or scoring purposes in the alien infection system.
protected float inseminatedCounter
Timer tracking the gestation period after successful alien insemination. Incremented each frame until reaching the burst threshold (typically 5-10 seconds), at which point an alien burster emerges from the unit's chest, killing the host.
protected float inseminationCounter
Timer tracking the insemination process while a face hugger is attached. Incremented while inseminatorUnit is attached, representing the infection progress. When it reaches the threshold, the unit becomes fully inseminated and the gestation phase begins.
protected int inseminationFrame
Frame counter for insemination animation or timing. Currently not actively used in the codebase. May have been intended for synchronizing insemination visual effects or for network replication of the infection state.
public AlienFaceHugger inseminatorUnit
Reference to the AlienFaceHugger currently attached to this unit's face. Set when a face hugger successfully attaches, cleared when the face hugger is destroyed or detaches. When set, prevents normal actions and begins the insemination process.
protected TestVanDammeAnim reviveSource
Reference to the hero that revived this character as a zombie. When set, enables the reviving player to control this zombie through input copying. Checked for zombie AI control decisions and cleared when zombie is destroyed.
protected float reviveZombieCounter
Periodic counter for zombie behavior updates. Triggers zombie-specific actions at 0.4 second intervals. Creates consistent zombie movement patterns and prevents continuous action spam.
protected float reviveZombieTime = 2f
Countdown timer before a revived zombie becomes active. Default 2 seconds, randomized on revival between 1.5-2.5 seconds. Prevents instant zombie activation after revival, creating a rising animation period.
protected float zombieDelay
Input delay for zombie movement control. Decremented during zombie input copying from controlling player. Creates intentional lag in zombie response to player commands for gameplay balance.
public float zombieOffset
Random offset (0-1) that creates behavioral variation between zombies. Used to desynchronize zombie movement and actions by offsetting timing calculations. Ensures multiple zombies don't move in perfect lockstep, creating more organic zombie hordes.
public int zombieTimerOffset
Integer offset for zombie action timing variations. Combined with zombieOffset to create unique behavior patterns for each zombie. Prevents synchronized zombie attacks and movements, making zombie groups feel more chaotic and unpredictable.
Acid Coverage System
Methods
protected virtual void AnimateActualDeath()
Displays standard ground death animation frame and deactivates gun sprite. Used for normal death situations when character dies on solid ground.
protected virtual void AnimateClimbingLadder()
Manages comprehensive ladder climbing animation with multiple movement states. Handles transition animations, idle climbing with gun positioning, movement-based climbing with footstep sounds, and specialized climbing animations for up/down movement. Includes proximity detection for ladder presence and appropriate animation fallbacks.
protected virtual void AnimateClimbingLadderTransition(bool intoClimbing)
Handles smooth transition animation between ladder climbing and normal movement states. Manages transition frame progression, frame rates, and sprite positioning during the 6-frame transition sequence.
Parameters:
- bool intoClimbing: True when transitioning into climbing mode, false when transitioning out of climbing mode
protected virtual void AnimateDancingFrames()
Displays dancing animation sequence using configurable frame cycling. Deactivates gun and cycles through dancing frames from the specified sprite sheet position with consistent frame rate.
protected virtual void AnimateDeath()
Death animation dispatcher that selects appropriate death animation based on character state. Prioritizes insemination frames if infected, falling death animation if airborne and not impaled, or standard ground death animation.
protected virtual void AnimateFallen()
Virtual method for fallen state animation. Empty implementation that can be overridden by derived classes to provide custom fallen animation behavior.
protected virtual void AnimateFallingDeath()
Displays falling death animation frame for characters dying while airborne. Provides different visual feedback compared to ground death.
protected virtual void AnimateGesture()
Handles comprehensive gesture animation sequences including salute, wave, point, flex, thrust, knee drop, and shush gestures. Manages frame progression, timing, special effects (flex sounds and face hugger disconnection), and looping behavior for different gesture types.
protected virtual void AnimateInseminationFrames()
Displays alien insemination animation frames based on infection progression. Uses calculated insemination frame index to show appropriate sprite frame from the insemination animation sheet.
protected virtual void AnimateWallAnticipation()
Manages wall climb anticipation animation with precise knife positioning based on vertical movement. Calculates knife stab positioning relative to previous climb heights and alternates between left and right knife hands for realistic climbing animation.
protected virtual void AnimateWallClimb()
Executes active wall climbing animation with realistic knife stab mechanics and height tracking. Manages velocity changes at specific animation frames, alternating knife hands, sound effects, and precise tracking of climbing progress relative to previous stab positions. Includes collision detection for wall interaction events.
protected virtual void AnimateWallDrag()
Handles wall sliding animation with knife-based climbing mechanics. Manages alternating knife hand positions, velocity-based frame selection, sound effects, and visual particle effects. Supports both new knife climbing frames and legacy animation systems.
protected virtual void ApplyWallClimbingGravity()
Applies specialized gravity calculations during wall climbing and dragging states. Provides reduced gravity during active climbing phases and maintains upward velocity during certain animation frames to create realistic wall climbing physics.
protected virtual void ChangeFrame()
Core animation frame dispatcher that routes to appropriate animation methods based on character state and action. Handles priority-based animation selection including frozen state, special unit states (on back, strung up, impaled), and action state-specific animations (idle, running, jumping, climbing, death). Also manages gun activation, sprite offsets, and frame counters for various animation systems.
protected void CheckAirDash()
Evaluates conditions for air dash availability and triggers dash if conditions are met. Checks for horizontal air dash availability, ground proximity for dash continuation, and downward air dash when moving straight down.
protected virtual void CheckHighFive()
Checks for nearby characters available for high-five interactions and manages high-five initiation timing.
protected virtual void CoverInAcid()
Covers TestVanDammeAnim in acid if not invulnerable and eligible. Sends RPC to all clients to apply acid coverage.
protected virtual void CoverInAcidRPC()
RPC method that applies acid coverage effects. Changes materials, handles alien-specific reactions, and initiates acid damage systems.
public virtual void CreateHighFiveEffects()
Creates visual and audio effects for successful high-five interactions including particles and screen effects.
public void ForceChangeFrame()
Forces an immediate frame change by calling the ChangeFrame method. Provides public access to trigger frame updates outside of the normal animation cycle.
public override bool HasBeenCoveredInAcid()
Checks if TestVanDammeAnim is currently covered in acid.
Returns:
bool
: True if covered in acid, false otherwise
public virtual void HighFiveBoost(bool activeHighFiveCharacter)
Applies high-five boost effects including speed enhancement and visual effects.
Parameters:
- bool activeHighFiveCharacter: Whether this character initiated the high-five
protected virtual void IncreaseFrame()
Advances the main animation frame counter and insemination frame counter if face hugger is attached. This method synchronizes both animation systems to ensure proper frame progression during alien infection states.
public bool IsGesturing()
Checks if character is currently performing any gesture animation by verifying the current gesture state is not None.
Returns:
bool
: True if character is performing a gesture, false otherwise
protected virtual void PlayFootStepSound(float v, float p)
Plays surface-appropriate footstep sounds with default volume and pitch settings (0.4 volume, 1.0 pitch).
protected virtual void PlayFootStepSound(float v, float p)
Plays surface-specific footstep sounds based on current environment and character state. Automatically selects appropriate sound arrays for quicksand, ladder climbing, or ground surface types (Dirt, Stone, Metal, Wood, Grass, Slime). Also triggers long grass sound effects when applicable.
Parameters:
- float v: Volume level for the footstep sound
- float p: Pitch level for the footstep sound
private bool PlayLongGrassSound(bool checkTimer = false)
Plays environment-specific footstep sounds for grass and blood surfaces with timing control. Checks for jiggle doodads on the current block to determine sound type, playing blood sounds at reduced volume for blood doodads or grass sounds for other doodads.
Parameters:
- bool checkTimer: Whether to respect the grass delay timer to prevent audio spam. If false, plays sound immediately regardless of timer
Returns:
bool
: True if a sound was played, false otherwise
protected virtual void ReleaseHighFive()
Handles releasing the high-five gesture. Updates animation frame, sets appropriate state flags, triggers frame change, and dismisses the high-five bubble if present.
public override void RemoveAcid()
Removes acid coverage from TestVanDammeAnim by sending RPC to all clients if conditions are met.
protected virtual void RemoveAcidRPC()
RPC method that removes acid coverage. Restores default material, enables gun sprite, and creates slime particle effects.
private void RunCoveredInAcid()
Handles ongoing acid coverage effects including cage busting damage, checkpoint recovery, melting animations, and acid particle generation.
protected virtual void RunStepOnWalls()
Triggers step-on events for wall surfaces during climbing or dragging. Performs raycasting to detect wall colliders and sends step messages for interaction with climbable surfaces.
public virtual void SetGestureAnimation(GestureElement.Gestures gesture)
Sets and manages gesture animation state with frame reset and multiplayer achievement tracking. Blocks movement during gesture animation and awards achievement when all 4 players perform gestures simultaneously.
Parameters:
- Gestures gesture: The gesture type to animate (None, Salute, Wave, Point, Flex, Thrust, KneeDrop, Shhh)
protected virtual void StartDashing()
Initiates dashing movement with speed multipliers and visual effects. Manages dash availability based on air state, applies speed modifiers with diminishing returns for successive dashes, and creates appropriate dash effects. Handles both ground and air dash scenarios.
protected virtual void StartHighFive()
Initializes the high-five gesture action. Resets related timers and flags, sets holding high-five state to true, resets the animation frame, and triggers a frame update.
protected virtual void TriggerFlexEvent()
Triggers perk system flex event for muscle flexing gestures. Activates associated perks and bonuses when character performs flex animation.
public override bool TryConnectHighFive()
Attempts to connect with nearby character for high-five interaction. Returns success status for networking.
Returns:
bool
: True if high-five connection successful, false otherwise
Fields
private float acidMeltTimer
Controls the melting process timing. Initialized to 1 second when acid is applied and can be extended by 0.3 seconds with additional acid damage. When it reaches 0, triggers the Melt method.
private float acidParticleTimer
Controls timing of acid particle effect spawning. Decrements each frame while covered in acid and resets to 0.1 seconds, triggering green slime particle creation at regular intervals.
public bool hasBeenCoverInAcid
Tracks whether unit is currently covered in acid. Blocks certain actions while true and triggers acid particle effects and melting process. Reset when recovering from acid effects.
private bool hasMelted
Indicates if unit has completed the melting process from acid damage. One-way flag that is never reset once set. Prevents particle spawning after melting is complete.
public ReactionBubble high5Bubble
Special reaction bubble specifically for high-five interactions. Displays prompts when players are close enough to perform a high-five. Shows button prompts and timing windows for successful high-five execution between players.
protected bool highFive
Current frame's high-five input state from player controls. When pressed, triggers high-five gesture attempts with nearby players.
protected bool highFiveBoost
Indicates if the high-five speed boost is currently active. When true, character movement speed is increased by the highFiveBoostM multiplier.
protected float highFiveBoostM = 1.4f
Speed multiplier applied during high-five boost. Default value of 1.4 provides a 40% speed increase. Applied by dividing movement calculations by this value.
protected float highFiveBoostTime
Remaining duration of the high-five boost effect in seconds. Counts down each frame while the boost is active.
protected float highfiveHoldTime
Tracks the duration the high-five gesture has been held. Increments during the high-five animation and resets to -1.5 after 0.5 seconds to create a cooldown period between high-fives.
protected bool highFiveNoBoost
Temporary state that prevents high-five boosts from being applied. Used to prevent boost stacking or rapid re-triggering of boosts.
protected float highFiveNoBoostTime
Duration of high-five boost prevention in seconds. Typically set to 0.2 seconds after certain actions. When this timer expires, highFiveNoBoost is automatically cleared.
protected bool holdingHighFive
Indicates that the character is currently initiating a high-five gesture. Set to true when starting a high-five and prevents air dashing while active. Automatically cleared after frame 2 of the high-five animation.
protected float ignoreHighFivePressTime
Cooldown timer that prevents rapid high-five or special ability triggering. Set to 0.1 seconds after certain actions and prevents new high-five attempts while greater than zero.
protected float lastRecoveredFromAcidTime
Timestamp tracking when unit last recovered from acid effects. Enforces minimum 1.5 second delay between recoveries for player-controlled units only.
public ReactionBubble player1Bubble
Reaction bubble UI element for player 1. Displays context-sensitive prompts like "PRESS X TO HIGH FIVE" or AFK indicators. Positioned above the character and shown/hidden based on game state and player proximity.
public ReactionBubble player2Bubble
Reaction bubble UI element for player 2. Functions identically to player1Bubble but for the second player. Enables multiplayer interaction prompts and status indicators specific to player 2's perspective.
public ReactionBubble player3Bubble
Reaction bubble UI element for player 3. Displays context-sensitive prompts and status indicators above the third player's character in 4-player local multiplayer. Functions identically to player1Bubble and player2Bubble but for the third player slot.
public ReactionBubble player4Bubble
Reaction bubble UI element for player 4. Displays context-sensitive prompts and status indicators above the fourth player's character in 4-player local multiplayer. Completes the set of player bubbles for full 4-player support.
protected bool releasingHighFive
Tracks when the high-five input has been released. Set when the player releases the high-five button and used to control the end of the high-five animation state.
protected float showHighFiveAfterMeleeTimer
Timer that delays high-five prompt display after melee attacks. Incremented after successful melee, triggers prompt at 1.5 seconds. Reset when melee is activated. Encourages cooperative play by prompting celebratory interactions after combat.
protected bool successfulHighFive
Indicates that a high-five has successfully connected with another player. When true and animation reaches frame 4, triggers high-five boost effects. Automatically cleared after the animation completes.
protected bool successfulHighFiveActiveBro
Identifies whether this character was the initiator of a successful high-five. Used to determine which player receives the high-five boost effect.
protected bool wasHighFive
Previous frame's high-five input state. Used for edge detection to determine when the high-five button is first pressed rather than held.
Kick System
Methods
private void CheckForKick()
Checks proximity to other players and handles kick interactions. Shows kick bubble when eligible, changes bubble material based on proximity, and executes kicks when conditions are met.
public void Kick()
Initiates player kick process by sending RPC to all clients if character hasn't been kicked yet.
private IEnumerator KickRoutine()
Coroutine that handles the visual kick countdown sequence. Flashes kick bubble materials with decreasing intervals, then gibs character and creates explosion effects.
Returns:
IEnumerator
: IEnumerator for coroutine execution
public void KickRPC()
RPC method that executes the kick sequence. Shows kick bubble, starts kick routine, and marks character as kicked.
private void ShowKickBubble()
Creates and displays the kick player bubble UI above the character. Sets up bubble parenting and restarts bubble animation.
private void StopKickBubble()
Stops the kick player bubble animation if it exists.