// Update is called once per frame void Update() { if (patching) { if (ActivityCheck.IsPressed(sprite.bounds, 0, Rotate.Side.RIGHT)) { patchTimer += Time.deltaTime; if (patchTimer >= patchTime) { // Hole patched HolePatchEvent(this); Destroy(gameObject); patching = false; } } else { // Stop patching patching = false; patchTimer = 0; } // Draw patch bar patchBar.enabled = patching; patchBar.fillAmount = 2 * patchTimer; patchBar.rectTransform.position = Input.mousePosition; } else if (ActivityCheck.IsClicked(sprite.bounds, 0, Rotate.Side.RIGHT)) { // Start patching AudioManager.Instance.Play("metal"); patching = true; patchTimer = 0; } }
// Update is called once per frame void Update() { bool isOperational = controllingModule.IsOperational(); switch (State) { case ModuleState.WORKING: if (!isOperational) { // Signal break State = ModuleState.BROKEN; } break; case ModuleState.READY: if (!isOperational) { State = ModuleState.BROKEN; } break; case ModuleState.BROKEN: if (isOperational) { // Fixed State = ModuleState.READY; } break; } if (ActivityCheck.IsClicked(switchSprite.bounds, 0, Rotate.Side.FRONT)) { if (State == ModuleState.READY) { State = ModuleState.WORKING; } } }
// Update is called once per frame void Update() { if (ActivityCheck.IsClicked(diskSprite.bounds, 0, Rotate.Side.FRONT)) { spinning = true; prevMousePos = ActivityCheck.GetMousePositionWorld() - spinCenter; //prevMousePos.z = 0; } else if (Input.GetMouseButtonUp(0)) { spinning = false; } if (spinning) { Vector3 mousePos = ActivityCheck.GetMousePositionWorld() - spinCenter; //mousePos.z = 0; float angle = Vector3.SignedAngle(prevMousePos, mousePos, diskSprite.transform.forward); spinEvent(angle / (spinsToFull * 360f)); transform.rotation *= Quaternion.AngleAxis(angle, diskSprite.transform.forward); prevMousePos = mousePos; } }