private void OnCollisionEnter(Collision collision) { WebShot ws = collision.gameObject.GetComponent <WebShot>(); if (rb == null || ws == null) { return; } Destroy(ws.gameObject); GameObject cover = Instantiate(webCover, transform.position, transform.rotation); cover.transform.parent = transform; rb.useGravity = true; StartCoroutine(EaseOutVelocity()); Destroy(gameObject, 5f); // We mostly destroy the object because the web cover is graphically intensive (see WebEncasing.cs). }
public void Handle() { Console.Write("."); if (!String.IsNullOrEmpty(context.Request.QueryString["url"])) { queueworker.AddNode("request", context.Request.RawUrl); WebShot webShot = new WebShot(context.Request.QueryString); if (webShot.url != null) { if (webShot.ReadyState != WebShot.wsReady) { queueworker.Enqueue(webShot); } if (queueworker.hash.Count <= queueworker.count - 1) { DateTime start = DateTime.Now; while (webShot.ReadyState == WebShot.wsNotReady) { TimeSpan span = DateTime.Now - start; if (span.Seconds > 3) { break; } Thread.Sleep(100); } } } if (webShot.ReadyState != WebShot.wsNotReady) { ResponseWrite(webShot.GetWebShot()); } else { ResponseWrite(webShot.GetWaitShot()); } } else if (context.Request.QueryString["xorbitmap"] == "true") { ResponseWrite(WebShot.GetXorBitmap()); } else { if (File.Exists("." + context.Request.RawUrl)) { ResponseWrite("." + context.Request.RawUrl); } else { context.Response.ContentType = "text/xml"; ResponseWrite(queueworker.GetXml()); } } try { context.Response.OutputStream.Close(); context.Response.Close(); } catch { } }