/// <summary>
/// Allows the game component to update itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
public override void Update(GameTime gameTime)
{
if (!myGame.camera.BoundingVolumeIsInView(unit.BoundingBox /*BoundingSphere*/) && !monsterModel.isRunning)
{
return;
}
monsterModel.animationController.Update(gameTime.ElapsedGameTime, Matrix.Identity);
if ((monsterModel.activeAnimation == MonsterModel.MonsterAnimations.TakeDamage ||
monsterModel.activeAnimation == MonsterModel.MonsterAnimations.Bite) &&
!monsterModel.animationController.IsPlaying)
{
if (monsterModel.isRunning)
{
monsterUnit.moving = true;
monsterModel.Run();
}
else
{
monsterUnit.moving = false;
monsterModel.Idle();
}
}
Vector3 pos = unit.position;
unit.position.Y = myGame.GetHeightAtPosition(pos.X, pos.Z);
base.Update(gameTime);
}