public ComboNodeTransition(ComboNode targetNode, float transitionBegin, float transitionEnd, ComboInput input) { this.targetNode = targetNode; this.transitionBegin = transitionBegin; this.transitionEnd = transitionEnd; this.input = input; }
public bool CanContinueCombo(ComboInput _input) { if (CanDoState()) { if (inputs[currentInputIndex].IsSameAs(_input)) { currentInputIndex += 1; if (currentInputIndex >= inputs.Count) { OnInputFinished?.Invoke(); currentInputIndex = 0; } return(true); } else { currentInputIndex = 0; return(false); } } else { return(false); } }
private void OnInput(ComboInput input) { ComboTime = TBARConfig.inputDelay; CurrentComboInputs.Add(input); PlayerStand.HandleImmediateInputs(player, (ImmediateInput)input); }
private void ListenAttackInput(InputInfo inputKey) { currentInput = new ComboInput { keyType = inputKey.virtualKey, comboCount = previousInput.comboCount + 1, expiredTime = 2f, timeStamp = inputKey.timeStamp }; UpdateCombo(); previousInput = currentInput; }
public ComboPanel(StandCombo combo) { this.BackgroundColor = new Color(new Vector3(0.4f)) * 0.5f; Name = new UIText(combo.ComboName, 1f); Name.VAlign = Name.HAlign = 0.5f; DescriptionPanel = new UIPanel(); DescriptionPanel.Width.Set(WIDTH, 0); DescriptionPanel.Height.Set(OPEN_HEIGHT / 2 + 20, 0); DescriptionPanel.HAlign = 0.5f; DescriptionPanel.VAlign = 1f; DescriptionPanel.BackgroundColor = new Color(new Vector3(0.4f)) * 0.5f; UIText desc = new UIText("This combo lacks description.", 0.85f) { HAlign = 0.5f, VAlign = 0.05f }; if (combo.Description != null) { desc.SetText(combo.Description.SpliceText(40)); } DescriptionPanel.Append(desc); DescriptionPanel.RecalculateChildren(); Width.Set(WIDTH, 0); Height.Set(CLOSED_HEIGHT, 0); UIPanel namePanel = new UIPanel(); namePanel.Width.Set(WIDTH, 0); namePanel.Height.Set(CLOSED_HEIGHT * 0.25f, 0); namePanel.BackgroundColor = new Color(new Vector3(0.4f)) * 0.5f; namePanel.Append(Name); OnClick += new MouseEvent(Expand); for (int i = 0; i < combo.RequiredInputs.Count; i++) { ComboInput c = combo.RequiredInputs[i]; InputButton button = new InputButton(c); button.Top.Set(CLOSED_HEIGHT * 0.33f, 0); button.Left.Set(2 + ((button.Width.Pixels + 4) * i), 0); this.Append(button); } this.Append(namePanel); }
private void Start() { _animator = GetComponent <Animator>(); InputManager.Instance.Register(EInputType.Action, EVirtualKeyType.Attack_1, ListenAttackInput); InputManager.Instance.Register(EInputType.Action, EVirtualKeyType.Attack_2, ListenAttackInput); InputManager.Instance.Register(EInputType.Action, EVirtualKeyType.EquipWeapon, Equip); InputManager.Instance.Register(EInputType.Action, EVirtualKeyType.UnequipWeapon, Unequip); layer = _animator.GetLayerIndex("SwordAttack"); previousInput = new ComboInput() { keyType = EVirtualKeyType.None, comboCount = -1 }; }
//============================== SISTEMA DE RITMO ========================================= /// <summary> /// Permite Añadir una vulnerabilidad. /// </summary> /// <param name="index">El índice de la vulnerabilidad, empieza en 0.</param> /// <param name="AttackTypes"> Un array de tipos de ataque para cada ataque.</param> public void AddVulnerability(int index, Tuple <int, Inputs>[] inputBinds) { if (vulnerabilityCombos == null) { vulnerabilityCombos = new Dictionary <int, ComboInput>(); } ComboInput data = new ComboInput(inputBinds); if (!vulnerabilityCombos.ContainsKey(index)) { vulnerabilityCombos.Add(index, data); } else { vulnerabilityCombos[index] = data; } }
public bool ContinueCombo(ComboInput i) { if (inputs[curInput].IsSameAs(i)) { curInput++; if (curInput >= inputs.Count) { onInputted.Invoke(); curInput = 0; } return(true); } else { curInput = 0; return(false); } }
public bool continueCombo(ComboInput i) { if (i.type == inputs[curInput].type) { curInput++; if (curInput >= inputs.Count) // Finished the inputs and the attack shoud play { onInputted.Invoke(); curInput = 0; } return(true); } else { curInput = 0; return(false); } }
//Checks to see if combo is still able to be done //Counts up each button input, and checks if it matches that position //If it does it stays as a potential combo public bool continueCombo(ComboInput i) { if (inputs[curInput].isSameAs(i)) { curInput++; if (curInput >= inputs.Count) // Finished the inputs and we should do the attack { onInputted.Invoke(); //Combo has been matched fully. call function curInput = 0; } return(true); } else { curInput = 0; return(false); } }
public bool continueCombo(ComboInput i) { if (inputs[currentIn].isSameAs(i)) { ++currentIn; if (currentIn >= inputs.Count) { onInput.Invoke(); currentIn = 0; } return(true); } else { currentIn = 0; return(false); } }
public InputButton(ComboInput input) { this.OverflowHidden = false; this.Width.Set(50, 0f); this.Height.Set(48, 0f); Text.VAlign = 0.35f; Text.HAlign = 0.5f; Text.TextColor = Color.Yellow; switch (input) { case ComboInput.Action1: string s = TBARInputs.ComboButton1.GetAssignedKeys()[0].Replace("Oem", ""); Text.SetText(s); break; case ComboInput.Action2: s = TBARInputs.ComboButton2.GetAssignedKeys()[0].Replace("Oem", ""); Text.SetText(s); break; case ComboInput.Action3: s = TBARInputs.ComboButton3.GetAssignedKeys()[0].Replace("Oem", ""); Text.SetText(s); break; case ComboInput.Up: Text.SetText(Main.cUp); break; case ComboInput.Down: Text.SetText(Main.cDown); break; } this.Append(Text); //Offset = (int)input; }
//public bool check = false; public bool continueCombo(ComboInput i) { if (inputs[curInput].isSameAs(i)) { curInput++; //check = true; if (curInput == inputs.Count) { //check = false; onInputed.Invoke(); curInput = 0; } return(true); } else { //check = false; curInput = 0; return(false); } }
public bool ExecuteCombo(ComboInput attackInput) { if (!IsExecutingCombo) { switch (attackInput) { case ComboInput.LightAttack: ExecuteNode(lightAttackRootNode); return(true); case ComboInput.HeavyAttack: ExecuteNode(heavyAttackRootNode); return(true); } return(false); } if (CurrentNode.GetNodeFromTransition(GetCurrentNodeStateInfo().normalizedTime, attackInput, out var node)) { ExecuteNode(node); return(true); } return(false); }
private void Update() { if (currentAttack != null) { if (attackTimer > 0) { attackTimer -= Time.deltaTime; } else { currentAttack = null; } return; } if (currentCombos.Count > 0) { leewayTimer += Time.deltaTime; if (leewayTimer >= comboLeeway) { if (lastInput != null) { Attack(GetAttackFromType(lastInput.attackType)); lastInput = null; } ResetCombos(); } } else { leewayTimer = 0; } ComboInput currentInput = null; if (Input.GetKeyDown(lightKey)) { currentInput = new ComboInput(AttackType.Light); } if (Input.GetKeyDown(heavyKey)) { currentInput = new ComboInput(AttackType.Heavy); } if (Input.GetKeyDown(specialKey)) { currentInput = new ComboInput(AttackType.Special); } if (currentInput == null) { return; } lastInput = currentInput; List <int> removeList = new List <int>(); for (int i = 0; i < currentCombos.Count; i++) { Combo combo = combos[currentCombos[i]]; if (combo.ShouldContinueCombo(currentInput)) { leewayTimer = 0; } else { removeList.Add(i); } } if (shouldSkipFrame) { //to prevent problems with update loop when calling ResetCombos() shouldSkipFrame = false; return; } for (int i = 0; i < combos.Count; i++) { if (currentCombos.Contains(i)) { continue; } if (combos[i].ShouldContinueCombo(currentInput)) { currentCombos.Add(i); leewayTimer = 0; } } foreach (int i in removeList) { currentCombos.RemoveAt(i); } if (currentCombos.Count <= 0) { Attack(GetAttackFromType(currentInput.attackType)); } }
public bool isSameAs(ComboInput test) { return(type == test.type); }
// Update is called once per frame void Update() { if (curAttack != null) { if (timer > 0) { timer -= Time.deltaTime; } else { curAttack = null; } return; } if (currentCombos.Count > 0) { leeway += Time.deltaTime; if (leeway >= comboLeeway) { if (lastInput != null) { Attack(getAttackFromType(lastInput.type)); lastInput = null; } ResetCombos(); } } else { leeway = 0; } ComboInput input = null; if (Input.GetKeyDown(heavyKey) || Input.GetKeyDown(heavyControler)) { input = new ComboInput(AttackType.heavy); } if (Input.GetKeyDown(lightKey) || Input.GetKeyDown(lightControler)) { input = new ComboInput(AttackType.light); } if (Input.GetKeyDown(spacialKey) || Input.GetKeyDown(spacialControler)) { input = new ComboInput(AttackType.special); } if (Input.GetKeyDown(blockKey) || Input.GetKeyDown(blockControler)) { input = new ComboInput(AttackType.block); } //hier staan de inputs /* ----Mocht er ooit een nieuwe key bij koemn voeg dan toe ---- * * if (Input.GetKeyDown(NONE)) * { * input = new ComboInput(AttackType.NONE); * } */ if (input == null) { return; } lastInput = input; List <int> remove = new List <int>(); for (int i = 0; i < currentCombos.Count; i++) { Combo c = combos[currentCombos[i]]; if (c.continueCombo(input)) { //Doe some thing leeway = 0; } else { remove.Add(i); } } if (skip) { skip = false; return; } for (int i = 0; i < combos.Count; i++) { if (currentCombos.Contains(i)) { continue; } if (combos[i].continueCombo(input)) { currentCombos.Add(i); leeway = 0; } } foreach (int i in remove) { currentCombos.RemoveAt(i); } if (currentCombos.Count <= 0) { Attack(getAttackFromType(input.type)); } }
public bool isSameAs(ComboInput test) { return(type == test.type); // add && movement == inputs[curInput].movement }
void Update() { if (possibleCombos.Count > 0) { currentComboInputTime += Time.deltaTime; if (currentComboInputTime >= comboInputTime) { if (lastInput != null) { lastInput = null; } ResetCombo(); } } else { currentComboInputTime = 0; } for (int i = 0; i < combos.Count; i++) { if (ps.playerCombo != PlayerComboState.None) { if (combos[i].IsEmptyKeyFirst()) { currentEmptyKeyTime += Time.deltaTime; if (currentEmptyKeyTime >= emptyKeyDuration) { combos[i].NextComboIndex(); currentEmptyKeyTime = 0; } } } else { combos[i].Reset(); } } ComboInput currentInput = null; if (ps.isMouseLeftClick) { currentInput = new ComboInput(InputSetting.Mouse_L); } if (ps.isForwardKey) { currentInput = new ComboInput(InputSetting.Forward); } if (ps.isBackwardKey) { currentInput = new ComboInput(InputSetting.Backward); } if (ps.isTurnLeftKey) { currentInput = new ComboInput(InputSetting.Left); } if (ps.isTurnRightKey) { currentInput = new ComboInput(InputSetting.Right); } if (currentInput == null) { return; } lastInput = currentInput; List <int> failCombos = new List <int>(); for (int i = 0; i < possibleCombos.Count; i++) { Combo c = combos[possibleCombos[i]]; if (c.CanContinueCombo(currentInput)) { currentComboInputTime = 0; } else { failCombos.Add(i); } } for (int i = 0; i < combos.Count; i++) { if (possibleCombos.Contains(i)) { continue; } if (combos[i].CanContinueCombo(currentInput)) { possibleCombos.Add(i); currentComboInputTime = 0; } } if (failCombos.Count > 0) { foreach (int i in failCombos) { possibleCombos.RemoveAt(i); } } if (possibleCombos.Count <= 0) { } }
public bool IsSameAs(ComboInput _input) { return(input == _input.input); }
void Update() { if (curAttack != null) { if (timer > 0) { timer -= Time.deltaTime; } else { curAttack = null; } return; } if (currentCombos.Count > 0) { leeway += Time.deltaTime; if (leeway >= comboLeeway) { if (lastInput != null) { Attack(getAttackFromType(lastInput.type)); lastInput = null; } ResetCombos(); } } else { leeway = 0; } ComboInput input = null; if (Input.GetButtonDown(owner.axisPrefix + "Punch")) { input = new ComboInput((AttackType.punch)); } if (Input.GetButtonDown(owner.axisPrefix + "Kick")) { input = new ComboInput((AttackType.kick)); } if (Input.GetButtonDown(owner.axisPrefix + "Dodge")) { input = new ComboInput((AttackType.dodge)); } if (input == null) { return; } lastInput = input; List <int> remove = new List <int>(); for (int i = 0; i < currentCombos.Count; i++) { Combo c = combos[currentCombos[i]]; if (c.ContinueCombo(input)) { leeway = 0; } else { remove.Add(i); } } if (skip) { skip = false; return; } for (int i = 0; i < combos.Count; i++) { if (currentCombos.Contains(i)) { continue; } if (combos[i].ContinueCombo(input)) { currentCombos.Add(i); leeway = 0; } } foreach (int i in remove) { currentCombos.RemoveAt(i); } if (currentCombos.Count <= 0) { Attack(getAttackFromType(input.type)); } }
public bool isSameAs(ComboInput i) { return(type == i.type); }
void CheckInputs() { if (currentCombosInChain.Count > 0) { inputTimer += Time.deltaTime; if (inputTimer >= comboButtonGap) { //Time is up, do stored attack if (readiedAttack != null) { Attack(readiedAttack); } else if (lastInput != null) { Attack(GetAttackFromType(lastInput.type)); } ResetCombos(); readiedAttack = null; lastInput = null; } } else { //No combo chain to check. keep inputTimer at 0 till we add inputs inputTimer = 0; //We may have pressed an attack that does not start a combo however, so we should check for last input if (lastInput != null) { Attack(GetAttackFromType(lastInput.type)); } } //Get Inputs ComboInput input = null; if (Input.GetKeyDown(heavyKey)) { input = new ComboInput(AttackType.heavy); } if (Input.GetKeyDown(lightKey)) { input = new ComboInput(AttackType.light); } if (Input.GetKeyDown(kickKey)) { input = new ComboInput(AttackType.kick); } if (input == null) { return; } //Store our last input for the attack if no combos matched lastInput = input; //If we overdid our combo chain for a combo attack. Kick it off our readied attack if (readiedAttack != null) { readiedAttack = null; } //Create list of items to remove if they don't match the combo List <int> remove = new List <int>(); for (int i = 0; i < currentCombosInChain.Count; i++) { ComboTypes c = combos[currentCombosInChain[i]]; if (c.continueCombo(input)) { inputTimer = 0; } else { remove.Add(i); } } foreach (int i in remove) { currentCombosInChain.RemoveAt(i); } for (int i = 0; i < combos.Count; i++) { if (currentCombosInChain.Contains(i)) { continue; } if (combos[i].continueCombo(input)) { currentCombosInChain.Add(i); inputTimer = 0; } } }
void Update() { if (curAttack != null) { if (timer > 0) { timer -= Time.deltaTime; } else { curAttack = null; } return; } if (currentCombos.Count > 0) { leeway += Time.deltaTime; if (leeway >= comboTimeInBetween) { if (lastInput != null) { Attack(getAttackFromType(lastInput.type)); lastInput = null; } ResetCombos(); } } else { leeway = 0; } // INPUTS ARE HERE____________________________________________________ ComboInput input = null; if (Input.GetKeyDown(heavyKey)) { input = new ComboInput(AttackType.heavy); } if (Input.GetKeyDown(lightKey)) { input = new ComboInput(AttackType.light); } if (Input.GetKeyDown(kickKey)) { input = new ComboInput(AttackType.kick); } if (input == null) { return; } lastInput = input; List <int> remove = new List <int>(); for (int i = 0; i < currentCombos.Count; i++) { Combo c = combos[currentCombos[i]]; if (c.continueCombo(input)) { leeway = 0; } else { remove.Add(i); } } if (skip) { skip = false; return; } for (int i = 0; i < combos.Count; i++) { if (currentCombos.Contains(i)) { continue; } if (combos[i].continueCombo(input)) { currentCombos.Add(i); leeway = 0; } } foreach (int i in remove) { currentCombos.RemoveAt(i); } if (currentCombos.Count <= 0) { Attack(getAttackFromType(input.type)); } }
public bool isSameAs(ComboInput test) { return(type == test.type); // Add && movement == test.movement }
void Update() { if (curAttack != null) { if (timer > 0) { timer -= Time.deltaTime; } else { curAttack = null; } return; } if (currentCombos.Count > 0) { leeway += Time.deltaTime; if (leeway >= comboLeeway) { if (lastInput != null) { //Attack(getAttackFromType(lastInput.type)); lastInput = null; } ClearAll(); } } else { leeway = 0; } input = null; if (_heavyAttack && !skip) { input = new ComboInput(AttacType.heavy); Attack(getAttackFromType(input.type)); //_player.Attack(1); _heavyAttack = false; } if (_lightAttack && !skip) { input = new ComboInput(AttacType.light); Attack(getAttackFromType(input.type)); //_player.Attack(1); _lightAttack = false; } // if (Input.GetKey(heavyKey)&&!skip) // { // input = new ComboInput(AttacType.heavy); // Attack(getAttackFromType(input.type)); // } // // if (Input.GetKeyDown(lightKey)&&!skip) // { // input = new ComboInput(AttacType.light); // Attack(getAttackFromType(input.type)); // } // // if (Input.GetKeyDown(kickKey)&&!skip) // { // input = new ComboInput(AttacType.kick); // Attack(getAttackFromType(input.type)); // } if (input == null) { return; } lastInput = input; for (int i = 0; i < currentCombos.Count; i++) { //print("attack"); Combo c = combos[currentCombos[i]]; if (c.continueCombo(input)) { leeway = 0; } } if (skip) { skip = false; return; } for (int i = 0; i < combos.Count; i++) { if (currentCombos.Contains(i)) { continue; } if (combos[i].continueCombo(input)) { currentCombos.Add(i); //print(currentCombos.Count); //Attack(getAttackFromType(input.type)); leeway = 0; } } // foreach (int i in remove) // { // currentCombos.RemoveAt(i); // } // if(currentCombos.Count<=0) // Attack(getAttackFromType(input.type)); }
// Update is called once per frame void Update() { if (currentAtk != null) { if (timer > 0) { timer -= Time.deltaTime; } else { currentAtk = null; } return; } if (currentCombos.Count > 0) { leeway += Time.deltaTime; if (leeway >= comboLeeway) { if (lastInput != null) { Attack(getAttackFromType(lastInput.type)); lastInput = null; } ResetCombos(); } } else { leeway = 0; } ComboInput input = null; if (Input.GetKeyDown(lowPunchKey) || Input.GetButtonDown("Fire1")) { input = new ComboInput(AttackType.lowPunch); } if (Input.GetKeyDown(highPunchKey) || Input.GetButtonDown("Fire2")) { input = new ComboInput(AttackType.highPunch); } if (Input.GetKeyDown(elbowKey)) { input = new ComboInput(AttackType.elbow); } if (input == null) { return; } lastInput = input; List <int> remove = new List <int>(); for (int i = 0; i < currentCombos.Count; ++i) { Combo c = combos[currentCombos[i]]; if (c.continueCombo(input)) { leeway = 0; } else { remove.Add(i); } } if (skip) { skip = false; return; } for (int i = 0; i < combos.Count; ++i) { if (currentCombos.Contains(i)) { continue; } if (combos[i].continueCombo(input)) { currentCombos.Add(i); leeway = 0; } } foreach (int i in remove) { currentCombos.RemoveAt(i); } if (currentCombos.Count <= 0) { Attack(getAttackFromType(input.type)); } }