Example #1
0
 void Start()
 {
     serverPoint        = new IPEndPoint(IPAddress.Parse(serverAddr), serverPort);
     networkPlayers     = new Dictionary <int, CaterpillarController>();
     networkEventMaster = GetComponent <NetworkEventMaster>();
     networkEventMaster.OnRegisterPackage += NetworkEventMaster_OnRegisterPackage;
     networkEventMaster.OnMovingPackage   += NetworkEventMaster_OnMovingPackage;
     networkEventMaster.OnNewTank         += NetworkEventMaster_OnNewTank;
     networkInterface = networkEventMaster.NetworkInterface;
     networkInterface.SendTo(new RegisterPackage()
     {
         tankID      = localTankID,
         isImportant = false,
         packageType = NetworkDataType.Register,
     }, serverPoint);
     localTank.GetComponent <CaterpillarLocalPrayer>().onMoving += OnMovingLocalTank;
 }