Hel's Hatred (Unity)

Hel's Hatred is a hack and slash game where the only purpose is to kill and destroy everything you see. By wreaking havoc in the towns the town boss spawns and will try to stop you. It was the first big project we did in a team. I was in charge of the player´s movement and animations. But also the camera and it´s targetting mode. The actual game and other usefull information about the project can be found on our wordpress page

The next code snippets shows code that allows the player to move in the direction the camera is pointing. It also adds a disable option

//Make player move in the cameras direction
if ((Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0) && !_targetEnemy)
	_cameraDirection = new Vector3(0.0f, Camera.main.transform.localEulerAngles.y, 0.0f);
	transform.localEulerAngles = _cameraDirection;

Vector3 tempDirectionTransform = transform.TransformDirection(Input.GetAxis("Horizontal"), 0.0f, Input.GetAxis("Vertical"));
_moveDirection.x = tempDirectionTransform.x;
_moveDirection.z = tempDirectionTransform.z;

if ((new Vector3(_moveDirection.x, 0.0f, _moveDirection.z) != Vector3.zero) && !_targetEnemy)
	if (!BoundToCamera)
		//Set player rotation to camera rotation
		transform.rotation = Quaternion.LookRotation(-1 * new Vector3(_moveDirection.x, 0.0f, _moveDirection.z));
		//Set player rotation independent to camera
		transform.rotation = Quaternion.LookRotation(new Vector3(Camera.main.transform.forward.x, 0.0f,

This snippet shows code of the implemented targetting feature.

//If we are targetting an enemy we move around it
else if ((new Vector3(_moveDirection.x, 0.0f, _moveDirection.z) != Vector3.zero) && _targetEnemy)
	this.transform.rotation = Quaternion.LookRotation(this.transform.position - new Vector3(_enemyPos.x, 0.0f, _enemyPos.z));
	this.transform.rotation = new Quaternion(this.transform.rotation.x * -1, 0, this.transform.rotation.z * -1, 0);
	transform.localEulerAngles = new Vector3(0.0f, transform.localEulerAngles.y, 0.0f);
Vector3 tempDir = new Vector3(_moveDirection.x, 0.0f, _moveDirection.z);
_controller.SimpleMove(tempDir * Speed);