public override IQueryElement VisitDrop_cls_method_dec_stm([NotNull] QueryGrammarParser.Drop_cls_method_dec_stmContext context) { DropMethod dropMethod = new DropMethod(); dropMethod.Name = context.NAME().GetText(); return(dropMethod); }
public PollServiceEventArgs( RequestMethod pRequest, string pUrl, HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, DropMethod pDrop, UUID pId, int pTimeOutms) { Request = pRequest; Url = pUrl; HasEvents = pHasEvents; GetEvents = pGetEvents; NoEvents = pNoEvents; Drop = pDrop; Id = pId; TimeOutms = pTimeOutms; }
//helps drop object on a supporting surface //especially useful if the object is ghosted when carried, so it doesn't drop through the floor void DropSelf(DropMethod method) { if (dropMethod == DropMethod.None) { return; } Bounds bounds = new Bounds(); if (gameObject.GetComponent <Renderer>()) { bounds = gameObject.GetComponent <Renderer>().bounds; } RaycastHit hit; float yOffset = 0.0f; int savedLayer = gameObject.layer; gameObject.layer = 2; //ignore self-raycast // see if this ray hit something if (Physics.Raycast(gameObject.transform.position, -Vector3.up, out hit)) { // determine how the y will need to be adjusted switch (method) { case DropMethod.Bottom: yOffset = gameObject.transform.position.y - bounds.min.y; break; case DropMethod.Origin: yOffset = 0.0f; break; case DropMethod.Center: yOffset = bounds.center.y - gameObject.transform.position.y; break; } gameObject.transform.position = hit.point; gameObject.transform.position = new Vector3(hit.point.x, hit.point.y + yOffset, hit.point.z); } // restore layer gameObject.layer = savedLayer; // from https://forum.unity.com/threads/here-is-an-editor-script-to-help-place-objects-on-ground.38186/ }