Thats the gist of it yes.
If you're Mafia, you're goal is to create a situation where it's impossible for town to win. As town however, you need to make sure this doesn't happen through the limited amount of time you have, like viewing someones behavior or traits of past games.
If per chance you are mafia, you're only goal is this-survive as long as possible, even if it means attacking your own teammates to protect yourself.