public async Task <IHttpActionResult> GetCutout(int uuid) { var errResult = TextHelper.CheckAuthorized(Request); if (errResult != null) { return(errResult); } Cutout item = await this.repository.GetByIdAsync(uuid); if (item == null) { return(NotFound()); } var result = new { ID = item.ID, DeviceNo = item.DeviceNo, DeviceName = item.Device.DeviceName, Reason = item.Reason, CreateTime = item.CreateTime, Remark = item.Remark }; return(Ok(result)); }
/// <summary> /// Cuts out the cutout from the given object at the given position (relative to the object). /// </summary> public static void CutOutObject(pb_Object o, Cutout c) { o.ToMesh(); o.Refresh(); Vector3 oldPostion = o.transform.position; Quaternion oldRotation = o.transform.rotation; o.transform.position = Vector3.zero; o.transform.rotation = Quaternion.identity; GameObject tempObject = new GameObject(); MeshFilter mf = tempObject.AddComponent <MeshFilter>(); mf.mesh = new CSG_Model(o.gameObject).ToMesh(); c.obj.transform.position = c.location; mf.mesh = CSG.Subtract(mf.gameObject, c.obj.gameObject); pb_MeshImporter mI = new pb_MeshImporter(o); mI.Import(tempObject, pb_MeshImporter.Settings.Default); o.transform.position = oldPostion; o.transform.rotation = oldRotation; Object.DestroyImmediate(tempObject); }
public async Task <IHttpActionResult> PostCutout([FromUri] Cutout Cutout) { var errResult = TextHelper.CheckAuthorized(Request); if (errResult != null) { return(errResult); } try { Cutout.CreateTime = DateTime.Now; await this.repository.AddAsync(Cutout); } catch (DbUpdateException) { if (this.repository.IsExist(Cutout.ID)) { return(Conflict()); } else { throw; } } return(Ok()); }
public async Task <IHttpActionResult> PutCutout(int uuid, [FromUri] Cutout Cutout) { var errResult = TextHelper.CheckAuthorized(Request); if (errResult != null) { return(errResult); } if (uuid != Cutout.ID) { return(BadRequest()); } try { Cutout.CreateTime = DateTime.Now; await this.repository.PutAsync(Cutout); } catch (DbUpdateConcurrencyException) { if (!this.repository.IsExist(uuid)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
void OnTriggerEnter2D(Collider2D collider) { if (collider.GetComponent <Slip>()) { slipEffect = collider.GetComponent <Slip>().coefficient; } if (collider.GetComponent <Cutout>()) { Cutout cutout = collider.GetComponent <Cutout>(); if (cutout.owner != this || cutout.lived > 1) { GameManager.Instance.KillPlayer(joystickId - 1); } } }
IEnumerator NextAggressor(float lastZ, bool doPushback = true) { yield return 0; //Skip frame CutoutType type = Cutout.CutoutTypes[Random.Range(0, Cutout.CutoutTypes.Count)]; Aggressor = Instantiate(Cutout.CutoutToGameobject[type]).GetComponent<Cutout>(); //-1 to ignore null cutout Aggressor.transform.SetParent(this.transform, true); Aggressor.velocity = SpawnNum * 0.6f + 14; if (CurrentPowerup == CutoutType._Frost) Aggressor.velocity /= 1.8f; if (CurrentPowerup == CutoutType._Reverse) Aggressor.velocity *= -1; float pushback = (Mathf.Sqrt(3 / (SpawnNum + 3)) + 0.4f) * Mathf.Abs(Aggressor.velocity); Aggressor.transform.position = new Vector3(0, 0, lastZ + (doPushback ? pushback : 0)); Aggressor.type = type; Renderer rend = Aggressor.GetComponent<Renderer>(); rend.material.SetColor(Game._V_WIRE_COLOR, Color.HSVToRGB(secondsIntoCycle / SecondsPerCycle, .64f, 1)); GamePlayControls.self.SwitchButtonSymbols(type, CurrentPowerup == CutoutType._Flash ? 0.06f : 0.2f); }
// DELETE: api/cutouts/3 public async Task <IHttpActionResult> DeleteCutout(int uuid) { var errResult = TextHelper.CheckAuthorized(Request); if (errResult != null) { return(errResult); } Cutout Cutout = await this.repository.GetByIdAsync(uuid); if (Cutout == null) { return(NotFound()); } await this.repository.DeleteAsync(Cutout); return(Ok()); }
IEnumerator InitAggressor() { yield return 0; //Skip frame CutoutType type = Cutout.CutoutTypes[Random.Range(0, Cutout.CutoutTypes.Count)]; Aggressor = Instantiate(Cutout.CutoutToGameobject[type]).GetComponent<Cutout>(); //-1 to ignore null cutout Aggressor.transform.SetParent(this.transform, true); Aggressor.transform.position = new Vector3(0, 0, 120); Aggressor.velocity = SpawnNum * 0.6f + 14; Aggressor.type = type; Renderer rend = Aggressor.GetComponent<Renderer>(); rend.material.SetColor(Game._V_WIRE_COLOR, Color.HSVToRGB(secondsIntoCycle / SecondsPerCycle, .64f, 1)); Aggressor.gameObject.SetActive(false); yield return 0; Aggressor.gameObject.SetActive(true); yield return new WaitForSeconds(1); GamePlayControls.self.SwitchButtonSymbols(type); }
public void Setup() { Game = new(); Agent = (Cutout)Game.Agents[nameof(Cutout)]; }