using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CharController : MonoBehaviour {

	public GameObject player;
	public int playerNum;
	public float speed = 6f;

	private string pname;

	void Awake () {
		pname = "P" + playerNum;
	}

	// Use this for initialization
	void Start () {
		player = gameObject;
	}
	
	// Update is called once per frame
	void Update () {
		Move ();
	}

	void Move () {
		Vector3 mvmt = new Vector3 (Input.GetAxis (pname + " X-Axis"), 0);
		player.transform.Translate (mvmt * speed * Time.deltaTime);

		if (!Vector3.Equals(mvmt, Vector3.zero))
			Debug.Log ( pname + "\t" + mvmt * speed * Time.deltaTime);
	}
}
