private void OnTriggerExit2D(Collider2D collision) { if (collision.tag == "Door") { _houseInRange = null; } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Door") { Debug.Log("At door"); _houseInRange = collision.GetComponent <LoadHouse>(); } }
// Use this for initialization void Start() { ip = new LoadHouse().LoadOptions()[0]; if(ip != "") { hasIP = true; } }
public void SaveOptionIP(string ip) { List<string> otherOptions; otherOptions = new LoadHouse().LoadOptions(); using (XmlWriter writer = XmlWriter.Create("Options.xml")) { writer.WriteStartDocument(); writer.WriteStartElement("Options"); writer.WriteElementString("IP", ip); writer.WriteEndElement(); writer.WriteEndDocument(); } }
// Use this for initialization void Start() { if (!File.Exists("Items.xml")) { new SaveHouse().SaveItems(); } items = new LoadHouse().LoadItems(); server = GameObject.FindGameObjectWithTag("Socket").GetComponent<packetmgr>(); server.registerConnectCB(new ConnectCB(info)); server.registerSUpdateCB(new sUpdateCB(sockUpdate)); server.registerWattUpdateCB(new sUpdateCB(sockPowerUpdate)); server.registerSInfoCB(new sUpdateCB(sockInfo)); server.registerDisconnectCB(new DisconnectCB(OnDisconnect)); server.registerXMLupdateCB(new xmlUpdateCB(XMLupdate)); server.registerPicUpdateCB(new recvPicCB(pictureUpdate)); ip = new LoadHouse().LoadOptions()[0]; //Connects to the server OnDisconnect(); }
//All network callbacks //If disconnected from the server, try to reconnect. void OnDisconnect() { string ip = new LoadHouse().LoadOptions()[0]; switch(server.connect(ip, 7648)) { case Connect_state.CONNECTED: Debug.Log("Connected!"); break; case Connect_state.FAILED_CONNECT: Debug.Log("Failed to connect"); break; case Connect_state.FAILED_PARSE_IP: Debug.Log("Failed to parse IPaddress"); break; } }