Your logic is wrong. First off you want lastAnimation to be a global variable since you want to be able to access it in multiple situations.
The logic you want to follow when cooking is:
Am I animating?
if not, has it been a few seconds since I last animated? If yes use fish on fire.
if yes, update lastAnimation and keep cooking.
So basically you want to have this check before you call goCook();