using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using Networking.Server;
using Networking;

public class NetworkedClient : MonoBehaviour
{

    public ServerObject server;

    //public Character character;
    public BlockInput input;

    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("Registering: " + LogicProtocols.SendLogicList);
        server.server.RegisterHandler(LogicProtocols.SendLogicList, RecieveLogicList);
    }
    
    public void RecieveLogicList(NetworkMessage msg)
    {
        LogicProtocols.LogicMsg logicMsg;
        if (!msg.TryRead(out logicMsg))
            return;

        input.blockReader.LogicChain = new List<LogicBlock>(logicMsg.elements);
        input.ReadAll();
    }
}
