private void Update() { if (!charState.isAttacking) { // check for attack command if (nextAttack.IsNull()) { AttackSetID atkOrder = ReceiveAtkCommands(); if (atkOrder != AttackSetID.None) { Attack(new AttackID(atkOrder, 0)); } } // execute next attack else { Attack(nextAttack); nextAttack = AttackID.Null; } return; } // check for command for next attack AttackSetID atkOrder2 = ReceiveAtkCommands(); if (atkOrder2 != AttackSetID.None) { AttackSet atkSet = attackSets[(int)curAtk.atkSetID]; Attack atk = atkSet.attacks[curAtk.atkID]; float atkLength = atk.animation.length; if (anim.GetCurrentAnimatorStateInfo(0).normalizedTime *atkLength >= atkLength - atk.precastTime) { // execute next attack in set if (atkOrder2 == curAtk.atkSetID && curAtk.atkID + 1 < atkSet.attacks.Count) { nextAttack = new AttackID(atkOrder2, curAtk.atkID + 1); } // break set and execute first attack of new set or repeat set else { nextAttack = new AttackID(atkOrder2, 0); } } } }
public AttackID(AttackSetID atkSetID, int atkID) { this.atkSetID = atkSetID; this.atkID = atkID; }