public void RemoveSelf() { if (color != null) { color.RemoveCartridge(); } color = null; }
// Start is called before the first frame update void Start() { paperShuffleDirection.Normalize(); printedSentences = new Dictionary <string, Result>(); printerText.text = ""; sentences = GetComponent <PrinterSentences>(); if (sentences == null) { sentences = GameObject.FindObjectOfType <PrinterSentences>(); } colors = GameObject.FindObjectOfType <ColorRepair>(); }
void Update() { if (isHolding) { if (Input.GetButton("Pickup") && (currentPickupCooldown <= 0f)) { Material mat = heldObject.GetComponent <Renderer>().material; SetOpaque(mat); if (snapLocation == null) { heldObject.transform.position = pickupLocation.transform.position + pickupLocation.transform.forward * 15 + new Vector3(0f, 3.5f, 0f); Rigidbody rb = heldObject.GetComponent <Rigidbody>(); heldObject.transform.parent = null; rb.isKinematic = false; rb.useGravity = true; Debug.Log(rb.velocity); heldObject = null; isHolding = false; currentPickupCooldown = playerPickupCooldown; } else { heldObject.transform.position = snapLocation.transform.position; InkAmount cart = heldObject.GetComponent <InkAmount>(); snapLocation.GetComponent <InkPlacement>().addCartrigeObject(heldObject); snapLocation.GetComponent <MeshRenderer>().enabled = false; heldObject.GetComponent <Rigidbody>().isKinematic = true; heldObject = null; isHolding = false; currentPickupCooldown = playerPickupCooldown; ColorRepair ink = snapLocation.GetComponent <ColorRepair>(); snapLocation = null; if (ink != null && cart != null) { ink.LoadCartridge(cart); } } } } if (currentRepairCooldown > 0f) { currentRepairCooldown -= Time.deltaTime; } if (currentPickupCooldown > 0f) { currentPickupCooldown -= Time.deltaTime; } }
public void UpdateColorRepair(ColorRepair cr) { color = cr; }