void Start() { listener = new UdpClient(listenPort); groupEP = new IPEndPoint(IPAddress.Any, listenPort); listenerRunning = true; boardManager = GameObject.Find("BoardManager").GetComponent<BoardManager>(); listeningThread = new Thread(Run); listeningThread.Start(); }
// initialization method public void Initialize(int posX, int posY, int HPStatus, int APStatus) { m_posX = posX; m_posY = posY; m_HP = HPStatus; m_AP = APStatus; boxCollider = GetComponent<BoxCollider2D>(); if (boardManager == null) { boardManager = GameObject.Find("BoardManager").GetComponent<BoardManager>(); } if (client == null) { client = boardManager.GetComponent<UDPClient>(); } transform.position = new Vector3(posX, posY, 0); }