private void OnTriggerExit(Collider other) { switch (other.tag) { case "PickupItem": InventoryItem item = other.GetComponent <InventoryItem>(); if (item == currentItem) { statInteractionUI.SetActive(false); currentItem = null; } break; case "Interaction": Interaction interaction = other.GetComponent <Interaction>(); if (interaction == currentInteraction) { currentInteraction = null; statInteractionUI.SetActive(false); } break; case "Repairable": RepairPart part = other.GetComponent <RepairPart>(); if (part == currentRepair) { currentRepair.StopRepair(); currentRepair = null; statInteractionUI.SetActive(false); } break; } }
/** Check if it belongs to the part that repairs this object. If so, attach back to this breakpoint */ private void OnTriggerEnter(Collider collision) { //Not broken? Don't care at all if (IsBroken == false) { return; } RepairPart repairPart = collision.gameObject.GetComponent <RepairPart>(); //not a repair part? ignore if (repairPart == null) { return; } Debug.Log("collision on breakpoint called with a repair part"); //check if this repair part is meant to fix this breakpoint if (ReferenceEquals(repairPart.BreakPoint, this) == true) { Debug.Log("Repair with valid part"); Repair(collision); } }
public ActionResult DeleteConfirmed(int id) { RepairPart repairPart = db.RepairParts.Find(id); db.RepairParts.Remove(repairPart); db.SaveChanges(); return(RedirectToAction("Index", new { id = repairPart.ScheduleId })); }
public ActionResult Edit([Bind(Include = "Id,PartName,Amount,Price,ScheduleId")] RepairPart repairPart) { if (ModelState.IsValid) { db.Entry(repairPart).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", new { id = repairPart.ScheduleId })); } ViewBag.ScheduleId = new SelectList(db.Schedules, "Id", "Car", repairPart.ScheduleId); return(View(repairPart)); }
// GET: RepairParts/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RepairPart repairPart = db.RepairParts.Find(id); if (repairPart == null) { return(HttpNotFound()); } return(View(repairPart)); }
// GET: RepairParts/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RepairPart repairPart = db.RepairParts.Find(id); if (repairPart == null) { return(HttpNotFound()); } ViewBag.ScheduleId = new SelectList(db.Schedules, "Id", "Car", repairPart.ScheduleId); return(View(repairPart)); }
public ActionResult Create([Bind(Include = "Id,PartName,Amount,Price,ScheduleId")] RepairPart repairPart, int id) { repairPart.ScheduleId = id; if (ModelState.IsValid) { db.RepairParts.Add(repairPart); db.SaveChanges(); return(RedirectToAction("Index", new { id = repairPart.ScheduleId })); } ViewBag.ScheduleId = new SelectList(db.Schedules, "Id", "Car", repairPart.ScheduleId); ViewBag.OrderId = id; return(RedirectToAction("Index", new { id = repairPart.ScheduleId })); }
private void OnTriggerEnter(Collider other) { switch (other.tag) { case "PickupItem": currentItem = other.transform.GetComponent <InventoryItem>(); if (currentItem.pickupTarget) { return; } statInteractionUI.SetActive(true); pickupText.SetText("E to Pickup " + currentItem.itemName); break; case "Interaction": currentInteraction = other.transform.GetComponent <Interaction>(); statInteractionUI.SetActive(true); pickupText.SetText("E to " + currentInteraction.interactionName); break; case "Repairable": currentRepair = other.transform.GetComponent <RepairPart>(); if (currentRepair.IsBroken) { statInteractionUI.SetActive(true); if (currentRepair.requiredTool == "" || (player.heldItem && player.heldItem.id.Equals(currentRepair.requiredTool))) { pickupText.SetText("Hold E to Repair"); } else { pickupText.SetText("Find a " + currentRepair.requiredTool); } } break; } }