private void Update() { jumpTimer.Countdown(Time.deltaTime); var jump = inputID.GetActionName(InputID.Action.JUMP); if (Input.GetButtonDown(jump) && jumpTimer.IsTimeUp() && IsGrounded()) { shouldJump = true; jumpTimer.SetCountdown(jumpCooldown); } }
// Update is called once per frame void Update() { var pickUp = inputID.GetActionName(InputID.Action.FIRE); if (Input.GetButtonDown(pickUp) && !HasPickupable()) { Collider2D[] colliders = GetOverlappingColliders(); var pickupableList = GetPickupable(colliders); if (pickupableList.Count > 0) { GameObject otherPlayer = null; foreach (var pickable in pickupableList) { if (pickable.layer == LayerMask.NameToLayer("Player")) { otherPlayer = pickable; otherPlayer.GetComponent <MovementComponent>().enabled = false; otherPlayer.GetComponent <PickUp>().enabled = false; break; } } if (otherPlayer != null) { PickupObject(otherPlayer); } else { PickupObject(pickupableList[0]); } } } }
// Update is called once per frame void Update() { var throwButton = inputID.GetActionName(InputID.Action.FIRE); Charge(throwButton); ChargeThrow(throwButton); ForceDropPlayer(); }