Boss AI
The boss throws physics-driven barrels and spawns reinforcements at health thresholds. On death, it switches to a ragdoll and opens the win screen.
Gameplay video
Throwing a barrel
public void ThrowBarrel()
{
GameObject barrel = Instantiate(barrelPrefab, throwOrigin.position, Quaternion.identity);
Rigidbody rb = barrel.GetComponent<Rigidbody>();
rb.AddForce(throwOrigin.forward * throwForce, ForceMode.Impulse);
}
Creates a barrel at throwOrigin and applies a forward impulse to its Rigidbody.
Boss death
public void Die()
{
animator.enabled = false;
ragdollRoot.SetActive(true);
winScreen.SetActive(true);
FN_SoundManager.PlaySound(SoundType.BossThrow, 1f);
}
Disables the animator, enables the ragdoll and displays the win screen.