protected override void ComputeVelocity() { jumpFrame = false; Vector2 move = Vector2.zero; move.x = input.Direction.x; if (input.GetButtonDown("Jump") && Grounded) { velocity.y = jumpTakeOffSpeed; isJumping = true; jumpFrame = true; jumpLift = currentLift; } else if (input.GetButtonUp("Jump")) { if (velocity.y > 0) { velocity.y *= 0.5f; } } TargetVelocity = move * maxSpeed; }
protected override void ComputeVelocity() { Vector2 move = Vector2.zero; move.x = input.Direction.x; if (input.GetButtonDown("Jump") && Grounded) { velocity.y = jumpTakeOffSpeed; } else if (input.GetButtonUp("Jump")) { if (velocity.y > 0) { velocity.y *= 0.5f; } } TargetVelocity = move * maxSpeed; }
protected virtual void Update() { if (canShoot) { if (input.GetButtonUp("Fire1") || shootSpeed >= 1.0f) { if (shootSpeed > float.Epsilon || useAutoShootSpeed) { Shoot(); } } else { if (input.GetButton("Fire1")) { shootSpeed += shootSpeedIncrement * Time.fixedDeltaTime; } else { shootSpeed = 0.0f; } } } }