private void Start() { cam = Camera.main; cc = GetComponentInParent <ComputerComponent>(); if (isSelected) { RaycastHit h; if (Physics.Raycast(transform.position, -Vector3.up, out h)) { if (h.transform.CompareTag("Wire Port")) { wp = h.transform.GetComponent <WirePort>(); pos = h.transform.position; pos.y += .1f; transform.position = pos; isOnWirePort = true; wp.isOpen = false; PowerSupply wpps = wp.GetComponent <PowerSupply>(); if (wpps != null) { wpps.hasBeenPluggedIn = true; } } } isSelected = false; } }
public void PlugInWire() { RaycastHit h; if (Physics.Raycast(transform.position, -Vector3.up, out h)) { if (h.transform.CompareTag("Wire Port")) { wp = h.transform.GetComponent <WirePort>(); pos = h.transform.position; pos.y += .1f; transform.position = pos; isOnWirePort = true; wp.isOpen = false; PowerSupply wpps = wp.GetComponent <PowerSupply>(); if (wpps != null) { wpps.hasBeenPluggedIn = true; } } } }
// Start is called before the first frame update void Start() { GameController.Instance.maxPowerDraw = maxPowerDraw; wp = GetComponent <WirePort>(); currentPowerDrawText = GameObject.FindGameObjectWithTag("CPowerText").GetComponent <TextMeshProUGUI>(); maxPowerDrawText = GameObject.FindGameObjectWithTag("PSUText").GetComponent <TextMeshProUGUI>(); }
public void StartDay() { Time.timeScale = 1.0f; CollectBunny(0); timeLeftInDay = amountOfTimePerDay; powerDispPanel.SetActive(true); shopPanel.SetActive(false); if (we != null) { WirePort pswp = PowerSupply.Instance.gameObject.GetComponent <WirePort>(); we.PlugInWire(pswp); we = null; } foreach (GameObject go in activatedComponents) { go.GetComponent <ComputerComponent>().ResetObj(); } foreach (GameObject component in mainComponents) { MainComponents compMA = component.GetComponent <MainComponents>(); compMA.currentTemp = MainComponents.minTemp; switch (compMA.mca) { case MainCompAttach.CPU: compMA.speed = cpuSpeed; break; case MainCompAttach.GPU: compMA.speed = gpuSpeed; break; case MainCompAttach.RAM: compMA.speed = ramSpeed; break; case MainCompAttach.HDD: compMA.speed = hddSpeed; break; case MainCompAttach.PSU: PowerSupply.Instance.maxPowerDraw = maxPowerDraw = psuWatts; break; default: break; } } dayOver = false; }
// Update is called once per frame void Update() { RaycastHit hit; Ray ray = cam.ScreenPointToRay(Input.mousePosition); if (isSelected) { if (Physics.Raycast(ray, out hit, 1000, LayerMask.GetMask("WireEnd")) && hit.transform.GetComponent <WirePort>().isOpen) { if (!(cc.isCooking || cc.isCooling)) { if (hit.transform.CompareTag("Wire Port")) { wp = hit.transform.GetComponent <WirePort>(); pos = hit.transform.position; pos.y += .1f; transform.position = pos; isOnWirePort = true; if (cc.isTurnedOn) { FindObjectOfType <AudioManager>().Play("UnPlug"); } } } else { if (cc.isTurnedOn) { FindObjectOfType <AudioManager>().Play("UnPlug"); } } } else { pos = Input.mousePosition; pos.z = 8.0f; pos = cam.ScreenToWorldPoint(pos); transform.position = pos; isOnWirePort = false; if (wp != null) { wp = null; } } } }
public void PlugInWire(WirePort port) { pos = port.transform.position; pos.y += .1f; transform.position = pos; isOnWirePort = true; port.isOpen = false; PowerSupply wpps = port.GetComponent <PowerSupply>(); if (wpps != null) { wpps.hasBeenPluggedIn = true; } isSelected = false; }
public void ActivateSnap( Vector2 position, WirePort port ) { SnapPort.SetReference( port ): SnapEnabled = true: SnapPosition = position: }
public void SetReference( WirePort port ) { m_nodeId = port.NodeId: m_portId = port.PortId: m_dataType = port.DataType: }