public void DoUpdate(ControlManager c) { AnimatorStateInfo animInfo = fsm.GetCurrentAnimatorStateInfo(0); state.DoUpdate(animInfo.fullPathHash); player.DoUpdate(state, c, ref frameInfo); playerAnimator.DoUpdate(player, ref frameInfo); playerAudio.DoUpdate(player, ref frameInfo); if (state.curr == AnimStates.IDLE) { if (c.isRollPressed && player.CanRoll) { fsm.SetTrigger(AnimParams.TRIGGER_ROLL); } else if (c.isAttackReleased) { if (frameInfo.toChargeAttack) { fsm.SetTrigger(AnimParams.TRIGGER_CHARGEATTACK); } else if (frameInfo.toAttack) { fsm.SetTrigger(AnimParams.TRIGGER_ATTACK); } } else if (c.isAttackPressed) { fsm.SetTrigger(AnimParams.TRIGGER_ATTACK); } else if (c.isMoved) { fsm.SetBool(AnimParams.ISMOVING, true); } } else if (state.curr == AnimStates.WALK) { if (c.isRollPressed && player.CanRoll) { fsm.SetTrigger(AnimParams.TRIGGER_ROLL); } else if (c.isAttackReleased) { if (frameInfo.toChargeAttack) { fsm.SetTrigger(AnimParams.TRIGGER_CHARGEATTACK); } else if (frameInfo.toAttack) { fsm.SetTrigger(AnimParams.TRIGGER_ATTACK); } } else if (c.isAttackPressed) { fsm.SetTrigger(AnimParams.TRIGGER_ATTACK); } else if (!c.isMoved) { fsm.SetBool(AnimParams.ISMOVING, false); } } else if (state.curr == AnimStates.ATTACK1) { if (c.isRollPressed && player.CanRoll) { fsm.SetTrigger(AnimParams.TRIGGER_ROLL); } else if (c.isAttackPressed && animInfo.normalizedTime >= (3f / 8)) { fsm.SetTrigger(AnimParams.TRIGGER_ATTACK); } } else if (state.curr == AnimStates.ATTACK2) { if (c.isRollPressed && player.CanRoll) { fsm.SetTrigger(AnimParams.TRIGGER_ROLL); } else if (c.isAttackPressed && (animInfo.normalizedTime >= (2f / 8))) { fsm.SetTrigger(AnimParams.TRIGGER_ATTACK); } } else if (state.curr == AnimStates.ATTACK3) { if (c.isRollPressed && player.CanRoll) { fsm.ResetTrigger(AnimParams.TRIGGER_ATTACK); fsm.SetTrigger(AnimParams.TRIGGER_ROLL); } else if (c.isAttackPressed && (animInfo.normalizedTime >= (6f / 8))) { fsm.ResetTrigger(AnimParams.TRIGGER_ROLL); fsm.SetTrigger(AnimParams.TRIGGER_ATTACK); } } else if (state.curr == AnimStates.CHARGEATTACK) { if (c.isRollPressed && player.CanRoll) { fsm.ResetTrigger(AnimParams.TRIGGER_ATTACK); fsm.SetTrigger(AnimParams.TRIGGER_ROLL); } else if (c.isAttackPressed && (animInfo.normalizedTime >= (6f / 8))) { fsm.ResetTrigger(AnimParams.TRIGGER_ROLL); fsm.SetTrigger(AnimParams.TRIGGER_ATTACK); } } else if (state.curr == AnimStates.ROLL) { if (state.hasChanged) { fsm.SetBool(AnimParams.ISMOVING, false); } if (c.isAttackReleased) { if (player.IsFullyCharged) { fsm.ResetTrigger(AnimParams.TRIGGER_ATTACK); fsm.SetTrigger(AnimParams.TRIGGER_CHARGEATTACK); } else if (player.IsCharging) { fsm.SetTrigger(AnimParams.TRIGGER_ATTACK); } } else if (c.isAttackPressed && !fsm.GetBool(AnimParams.TRIGGER_CHARGEATTACK)) { fsm.SetTrigger(AnimParams.TRIGGER_ATTACK); } } frameInfo.Reset(); }