void HandleYInput(float y_input) { if (y_input <= -.5f && drop_routine == null && cont.OverPlatform() && MyInput.GetButtonDown("Jump", jump_buffer)) { if (cont.OverPlatform()) { drop_routine = StartCoroutine(DropRoutine()); } MyInput.ClearBuffer("Jump"); } else if (drop_routine == null && player.can_move && MyInput.GetButtonDown("Drop")) { drop_routine = StartCoroutine(DropRoutine()); } else if (player.can_move && MyInput.GetButtonDown("Jump", jump_buffer)) { if (cont.collisions.below) { Jump(true); } else if (jumps_used < (player.jump_count - (grounded_jump_used ? 0 : 1))) { Jump(false); } } }
private void Update() { if (GameManager.instance.input_active && player.can_input) { if (MyInput.GetButton("Attack")) { bool skill_used = ProcessSkillButton(MyInput.GetAxis("Attack"), 0); if (skill_used) { MyInput.ClearBuffer("Attack"); } } if (MyInput.GetButtonDown("Skill1", skill_buffer)) { bool skill_used = ProcessSkillButton(MyInput.GetAxis("Skill1"), 1); if (skill_used) { MyInput.ClearBuffer("Skill1"); } } if (MyInput.GetButtonDown("Skill2", skill_buffer)) { bool skill_used = ProcessSkillButton(MyInput.GetAxis("Skill2"), 2); if (skill_used) { MyInput.ClearBuffer("Skill2"); } } if (MyInput.GetButtonDown("Skill3")) { bool skill_used = ProcessSkillButton(MyInput.GetAxis("Skill3"), 3); if (skill_used) { MyInput.ClearBuffer("Skill3"); } } if (MyInput.GetButtonDown("ActiveSkill")) { if (player.inventory.active_item != null) { player.inventory.active_item.active_ability.TryUse(); } } if (MyInput.GetButtonDown("UseConsumable")) { player.inventory.TryUseConsumable(); } } input = new Vector2(MyInput.GetAxis("Horizontal"), MyInput.GetAxis("Vertical")); Move(); }
IEnumerator JumpRoutine() { jumping = true; float time_left = max_jump_hold; bool held = true; while (time_left > 0 && held && !cont.collisions.above) { time_left -= GameManager.GetFixedDeltaTime(player.team); held = held && MyInput.GetButton("Jump"); yield return(new WaitForFixedUpdate()); } MyInput.ClearBuffer("Jump"); jumping = false; }