コード例 #1
0
    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;
        }
    }
コード例 #2
0
    /** 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);
        }
    }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            RepairPart repairPart = db.RepairParts.Find(id);

            db.RepairParts.Remove(repairPart);
            db.SaveChanges();
            return(RedirectToAction("Index", new { id = repairPart.ScheduleId }));
        }
コード例 #4
0
 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));
 }
コード例 #5
0
        // 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));
        }
コード例 #6
0
        // 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));
        }
コード例 #7
0
        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 }));
        }
コード例 #8
0
    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;
        }
    }