Boss AI
The boss enemy combines animation logic with modular spawning and ragdoll physics. It uses health-based triggers to escalate encounters, throw barrels, and eventually trigger the end of the level.
GIF Preview
Main Responsibilities
- Throws physics-based barrels during combat.
- Spawns reinforcements based on health thresholds.
- Handles win condition via ragdoll and audio.
Core Method (Barrel Throw)
public void ThrowBarrel()
{
GameObject barrel = Instantiate(barrelPrefab, throwOrigin.position, Quaternion.identity);
Rigidbody rb = barrel.GetComponent();
rb.AddForce(throwOrigin.forward * throwForce, ForceMode.Impulse);
}
spawns and launches barrel via physics
Trigger: Win Condition
public void Die()
{
animator.enabled = false;
ragdollRoot.SetActive(true);
winScreen.SetActive(true);
FN_SoundManager.PlaySound(SoundType.BossThrow, 1f);
}
activates ragdoll and win state