using UnityEngine;
using System.Collections;

public class DirectionSwitch : MonoBehaviour {
	
	[SerializeField]
	KeyCode NewMoveUp;
	[SerializeField]
	KeyCode NewMoveDown;
	[SerializeField]
	KeyCode NewMoveLeft;
	[SerializeField]
	KeyCode NewMoveRight;
	[SerializeField]
	private AudioClip SwitchDirection;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	void OnTriggerEnter2D(Collider2D other)
	{
			if (other.CompareTag("Player"))
			{
				other.GetComponent<CharacterMovementController>().moveUp = NewMoveUp;
				other.GetComponent<CharacterMovementController>().moveLeft = NewMoveLeft;
				other.GetComponent<CharacterMovementController>().moveDown = NewMoveDown;
				other.GetComponent<CharacterMovementController>().moveRight = NewMoveRight;
				Camera.main.GetComponent<AudioController>().PlaySoundEffect(SwitchDirection);
			}
	}
}
