// 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() { int mouseDown = -1; if (Input.GetMouseButton(0)) { mouseDown = 0; } else if (Input.GetMouseButton(1)) { mouseDown = 1; } if (mouseDown >= 0) { float sign = mouseDown == 0 ? +1 : -1; if (ActivityCheck.IsPressed(sr.bounds, mouseDown, Rotate.Side.LEFT)) { Value += sign * speed * Time.deltaTime; } } }
// 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; } } }
public IActionResult CreateActivity(ActivityCheck check) { int?id = HttpContext.Session.GetInt32("userId"); if (id == null) { return(RedirectToAction("RegisterPage", "User")); } else { if (ModelState.IsValid) { if (check.ActivityDate > DateTime.Now) { Activity newActivity = new Activity { Title = check.Title, ActivityTime = check.ActivityTime, ActivityDate = check.ActivityDate, Duration = check.Duration, Description = check.Description, UserId = (int)HttpContext.Session.GetInt32("userId") }; _context.Activities.Add(newActivity); _context.SaveChanges(); return(RedirectToAction("ActivityPage", new{ activityId = newActivity.ActivityId })); } else { return(View("NewActivity")); } } else { return(View("NewActivity")); } } }
// 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; } }