public void Create() { if (server != null) { if (__server != null) { Destroy(__server.gameObject); } __server = Instantiate(server); if (__server != null) { __server._isLocalPlayer = true; __server._index = 0; __server._host = this; if (__server._onCreate != null) { __server._onCreate(); } } } if (client != null) { if (__client != null) { Destroy(__client.gameObject); } __client = Instantiate(client); if (__client != null) { __client._isLocalPlayer = true; __client._index = 1; __client._host = this; if (__client._onCreate != null) { __client._onCreate(); } } } }
public bool Replace(int index, Node target) { if (__nodes == null) { return(false); } Node temp; if (!__nodes.TryGetValue(index, out temp)) { return(false); } if (target != null) { target.CopyFrom(temp); } if (temp is Node) { if (temp._onDestroy != null) { temp._onDestroy(); } } if (temp != null) { Destroy(temp.gameObject); } __nodes[index] = target; if (target._onCreate != null) { target._onCreate(); } return(true); }