public void ReceiveInput(CombatInput input) { Debug.Log(input.combatType); if (!isAttacking) { HandleInput(); } }
public bool StackInput(CombatInput input) { timer = carryTime; stackedInputs.Add(input); return(EvaluateCombo()); }
public void ReceiveInput(CombatInput input) { if (this.input == null) { this.input = input; } HandleInput(); }
public void HandleInput() { if (input != null) { if (ECombatInputType.WEAK_ATTACK.Equals(input.combatType)) { animator.SetTrigger("attack"); } else if (ECombatInputType.STRONG_ATTACK.Equals(input.combatType)) { animator.SetTrigger("strongAttack"); } else if (ECombatInputType.BOTH_ATTACKS.Equals(input.combatType)) { animator.SetTrigger("bothAttack"); } input = null; } }
// Update is called once per frame void Update() { //start delay before starting regen if (startRegeningStamina) { timerRestDelay += Time.deltaTime; } //can start regen if (timerRestDelay >= staminaRestDelay) { startRegeningStamina = false; if (currStamina < torsoPart.maxStamina) { timer += Time.deltaTime; if (timer >= torsoPart.staminaRegen) { timer = 0; CurrStamina++; } } } //Handle Block animation state. if (Input.GetKeyDown(KeyCode.Q)) { armPart.Block(); } else if (Input.GetKeyUp(KeyCode.Q)) { armPart.UnBlock(); } if (Input.GetKeyDown(KeyCode.I)) { CanAttack = !CanAttack; bool ui = inventory.SwitchUI(); myCamera.UseMouseLook = !ui; } ECombatInputType someInputWasPressed = noInput; if (CanAttack) { if (Input.GetMouseButtonDown(0)) { someInputWasPressed = ECombatInputType.WEAK_ATTACK; } if (Input.GetMouseButtonDown(1)) { if (someInputWasPressed == ECombatInputType.WEAK_ATTACK) { someInputWasPressed = ECombatInputType.BOTH_ATTACKS; } else { someInputWasPressed = ECombatInputType.STRONG_ATTACK; } } if (someInputWasPressed != ECombatInputType.NONE) { CombatInput input = new CombatInput(speed, isJumping, isSprinting, someInputWasPressed); armPart.AttackInput(input); } } if (isSprinting) { timerStaminaRate += Time.deltaTime; if (timerStaminaRate >= legPart.RunningStaminaRate) { CurrStamina -= legPart.RunningStaminaCost; timerStaminaRate = 0; } } }
// Use this for initialization void Start() { input = null; isAttacking = false; }
public void AttackInput(CombatInput input) { fightHandler.ReceiveInput(input); }
public State(CombatInput combatInput, MovementInput movement) { MovementInput = movement; CombatInput = combatInput; }
private void GetCombatInput() { //Description: Parses combat input and calls specific functions in reaction to particular events/criteria //Initializations & Validations: if (leftArm == null || rightArm == null) //If player is missing combat-necessary equipment { Debug.LogError("Player is missing arm equipment"); //Log error return; //Skip remainder of function to prevent further errors } CombatInput prevCombatInput = combatInput; //Save current combat inputs as previous input values bool newLeftLean = false; //Initialize value to store new left lean input bool newRightLean = false; //Initialize value to store new right lean input bool newSting = false; //Initialize value to store new sting input //Get New Inputs: if (Input.GetKey(KeyCode.Mouse0)) { newLeftLean = true; //Get current left lean input } if (Input.GetKey(KeyCode.Mouse1)) { newRightLean = true; //Get current right lean input } if (Input.GetKey(KeyCode.Mouse2)) { newSting = true; //Get current sting input } combatInput = new CombatInput(newLeftLean, newRightLean, newSting); //Store new input variables //Register Combat Input Events: SendMessageOptions drr = SendMessageOptions.DontRequireReceiver; //Initialize messageoptions shorthand if (newLeftLean != prevCombatInput.leftLean) //Change in leftLean input detected... { if (newLeftLean) { BroadcastMessage("OnLeftLeanButtonDown", drr); //Signal that leftLean button has been pressed } else { BroadcastMessage("OnLeftLeanButtonUp", drr); //Signal that leftLean button has been released } } if (newRightLean != prevCombatInput.rightLean) //Change in rightLean input detected... { if (newRightLean) { BroadcastMessage("OnRightLeanButtonDown", drr); //Signal that rightLean button has been pressed } else { BroadcastMessage("OnRightLeanButtonUp", drr); //Signal that rightLean button has been released } } if (newSting != prevCombatInput.sting) //Change in sting input detected... { if (newSting) { BroadcastMessage("OnStingButtonDown", drr); //Signal that sting button has been pressed } else { BroadcastMessage("OnStingButtonUp", drr); //Signal that sting button has been released } } //..Xx Debuggers xX................................................................................. }