New theory of consciousness in humans, animals and artificial intelligence