You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
888 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Networking;
  5. using Networking.Server;
  6. using Networking;
  7. public class NetworkedClient : MonoBehaviour
  8. {
  9. public ServerObject server;
  10. //public Character character;
  11. public BlockInput input;
  12. // Start is called before the first frame update
  13. void Start()
  14. {
  15. Debug.Log("Registering: " + LogicProtocols.SendLogicList);
  16. server.server.RegisterHandler(LogicProtocols.SendLogicList, RecieveLogicList);
  17. }
  18. public void RecieveLogicList(NetworkMessage msg)
  19. {
  20. LogicProtocols.LogicMsg logicMsg;
  21. if (!msg.TryRead(out logicMsg))
  22. {
  23. Debug.Log("Recieved unknown message");
  24. return;
  25. }
  26. input.blockReader.LogicChain = new List<LogicBlock>(logicMsg.elements);
  27. input.ReadAll();
  28. }
  29. }