using UnityEngine;
using System.Collections;

public class OtherPlayerMessageReceiver : MonoBehaviour {

	[SerializeField]
	GameObject buttonMaster;

	private NetworkPlayerCommandButton[] buttons;

	void Start()
	{
		buttons = buttonMaster.GetComponentsInChildren<NetworkPlayerCommandButton>();
	}

	[RPC]
	void OnPlayerLose()
	{
		for(int i = 0; i < buttons.Length; i++)
		{
			buttons[i].SetNumberOfTaps(1);
		}
	}

	[RPC]
	void OnPlayerTurnFinished()
	{
		Application.LoadLevel("Main Game");
	}

	[RPC]
	public void SendTap()
	{
		for(int i = 0; i < buttons.Length; i++)
		{
			buttons[i].OnTap();
		}
	}

}
