// Update is called once per frame void Update() { fireDown1 = input.GetDown(input.fire1); fireDown2 = input.GetDown(input.fire2); fireUp1 = input.GetUp(input.fire1); fireUp2 = input.GetUp(input.fire2); released1 = fireUp1 && firing1 ? true : released1; released2 = fireUp2 && firing2 ? true : released2; if (fireDown1 && !(firing1 || firing2)) { draw1(); } else if (fireDown2 && !(firing1 || firing2)) { draw2(); } if (released1 && !bow.animation["Draw"].enabled) { release1(); } else if (released2 && !bow.animation["Draw"].enabled) { release2(); } }
// Update is called once per frame void Update() { if (input.GetDown(input.fire2)) { fire(); } }
// Update is called once per frame void Update() { animation["Down"].speed = attackSpeed; animation["Up"].speed = attackSpeed; waiting = (animation["Down"].enabled || animation["Up"].enabled); if (input.GetDown(input.fire1)) { swing(); } swinging = animation["Down"].enabled; if (animation["Down"].time >= animation["Down"].length) { animation.Play("Up"); } }
// Update is called once per frame void Update() { if (input.GetDown(input.fire2)) { if (animation["Up"].time < 0) { animation["Up"].time = 0; } animation["Up"].speed = 1; } else if (input.GetUp(input.fire2)) { if (animation["Up"].time > animation["Up"].length) { animation["Up"].time = animation["Up"].length; } animation["Up"].speed = -1; } animation.Play("Up"); if (animation["Up"].time >= animation["Up"].length) { wasDown = false; if (!wasUp) { wasUp = true; player.physicalResistance *= 2; } } else if (!wasDown) { wasUp = false; wasDown = true; player.physicalResistance /= 2; } }
// Update is called once per frame void Update() { if (input.GetDown(input.start)) { pause(); } knockbackSpeed += knockback.x; if (Time.deltaTime != 0) { if (controller.isGrounded) { moveVec.y = 0; if (input.GetState(input.right)) { moveSpeed += acceleration; } if (input.GetState(input.left)) { moveSpeed -= acceleration; } if (moveSpeed > drag || moveSpeed < -drag) { moveSpeed -= moveSpeed * drag; } else { moveSpeed = 0; } if (input.GetDown(input.jump)) { moveVec.y += jumpHeight; if (moveSpeed != 0) { jumpBoost += jumpHeight / 5 * Mathf.Sign(moveSpeed); } } if (knockbackSpeed > drag || knockbackSpeed < -drag) { knockbackSpeed -= knockbackSpeed * drag; } else if (knockbackSpeed != 0) { knockbackSpeed = 0; } if (jumpBoost > drag || jumpBoost < -drag) { jumpBoost -= jumpBoost * drag; } else if (jumpBoost != 0) { jumpBoost = 0; } } moveVec -= Vector3.up * gravity * Time.deltaTime; if (moveVec.y < terminalVelocity) { moveVec.y = terminalVelocity; } if (moveSpeed > maxSpeed) { moveSpeed = maxSpeed; } else if (moveSpeed < -maxSpeed) { moveSpeed = -maxSpeed; } moveVec.x = moveSpeed + knockbackSpeed + jumpBoost; moveVec.y += knockback.y; knockback = Vector3.zero; controller.Move(moveVec * Time.deltaTime); if (input.AimVector.x > transform.position.x) { transform.LookAt(transform.position + Vector3.right); } else { transform.LookAt(transform.position - Vector3.right); } } }
protected void Update() { if (Screen.width != oldWidth) { initialized = true; if (InputController.PlayerCount == 1) { scale = Scale; viewport = new Rect(0, 0, Screen.width, Screen.height); } else { scale = Scale / 2; switch (playerNumber) { case 1: viewport = new Rect(0, 0, Screen.width / 2, Screen.height / 2); break; case 2: viewport = new Rect(Screen.width / 2, 0, Screen.width / 2, Screen.height / 2); break; case 3: viewport = new Rect(0, Screen.height / 2, Screen.width / 2, Screen.height / 2); break; case 4: viewport = new Rect(Screen.width / 2, Screen.height / 2, Screen.width / 2, Screen.height / 2); break; } } oldWidth = Screen.width; } if (!InputController.controllerMode) { newPos = Input.mousePosition; mouseMode = newPos != oldPos; } else { mouseMode = false; } if (input.GetDown(input.activate) || input.GetDown(input.fire1) || input.GetDown(input.jump)) { select(selected); } if (input.GetDown(input.down) && selected < content.Length - 1 && !input.GetDown(input.activate)) { selected++; } else if (input.GetDown(input.up) && selected > 0 && !input.GetDown(input.activate)) { selected--; } if (mouseMode) { if (current != null) { for (int i = 0; i < elementRects.Length; i++) { selected = elementRects[i].Contains(current.mousePosition) ? i : selected; } } } if (selected != selectedL) { content[selectedL] = baseTextures[selectedL]; content[selected] = activeTextures[selected]; selectedL = selected; } oldPos = Input.mousePosition; }