public void SetCharacterToThrow(Character chara) { if(characterToThrow != null) { characterToThrow.CancelAction(); characterToThrow.state = CharacterState.Hit; characterToThrow.JumpDefault(); } characterToThrow = chara; }
private void JumpAction() { if (character.InAir == false) { doubleJump = false; if (Input.GetAxis(controllerLeftHorizontal) > 0.2f) { character.Direction = 1; crouchTime = crouchJumpTime; character.Action(crouchController); } else if (Input.GetAxis(controllerLeftHorizontal) < -0.2f) { character.Direction = -1; crouchTime = crouchJumpTime; character.Action(crouchController); } else { character.SetSpeed(0, 0); character.JumpDefault(); } } StopBuffer(); }
// ========================================================================================= /*private void InputDash() { if ((Input.GetButtonDown("ControllerB") || bufferDashActive == true) && state == CharacterState.Acting && canMoveCancel == true && currentAttack != null) { if (currentAttack.AttackBehavior.DashCancel == true) CancelAction(); } else if (Input.GetButtonDown("ControllerB") && state == CharacterState.Acting) { bufferDashActive = true; StartBuffer(); } if (state != CharacterState.Idle && state != CharacterState.Moving || inAir != false) { return; } if(bufferDashActive == true) { DashAction(); } else if (Input.GetButtonDown("ControllerB")) { DashAction(); } } private void DashAction() { if (Mathf.Abs(Input.GetAxis("Horizontal")) > 0.2f) { Action(dashForward); } else { Action(dashBack); } StopBuffer(); }*/ // ========================================================================================= private void InputJump(Character character, CharacterState state) { if (crouchTime > 0 && character.State != CharacterState.Acting) { crouchTime = 0; } if (crouchTime > 0) { crouchTime -= Time.deltaTime;// * characterMotionSpeed; if (crouchTime <= 0) { character.SetSpeed(character.CharacterStat.GetSpeed() * character.Direction, 0); character.CancelAct(); character.JumpDefault(); return; } } if(bufferJumpActive == true) { if(state == CharacterState.Idle || state == CharacterState.Moving) { JumpAction(); } else if (state == CharacterState.Acting && character.CanMoveCancel == true && character.CurrentAttack != null) { if (character.CurrentAttack.AttackBehavior.JumpCancel == true) { character.CancelAction(); JumpAction(); } } } if (Input.GetButtonDown(controllerA)) { bufferJumpActive = true; StartBuffer(); if (state == CharacterState.Idle || state == CharacterState.Moving) { JumpAction(); } else if (state == CharacterState.Acting && character.CanMoveCancel == true && character.CurrentAttack != null) { if (character.CurrentAttack.AttackBehavior.JumpCancel == true) { character.CancelAction(); JumpAction(); } } } }