private int[] animationEnd = new int[(int)COMBAT_STATE.NUM_STATES + 1]; // In frames private void Init() { state = 0; animationEnd[0] = 0; animationEnd[1] = state1_Charging; animationEnd[2] = state2_Charged; animationEnd[3] = state3_WeakDuration; animationEnd[4] = state4_StrongDuration; animationEnd[5] = state5_ShieldUp; }
public void OnEnemyCombatEnd() { m_CombatState = COMBAT_STATE.PLAYER_TURN; }
public void OnPlayerCombatEnd() { m_CombatState = COMBAT_STATE.ENEMY_TURN; OnEnemyCombatBegin(); }
// OVERRIDE END private void HandleAttack() { COMBAT_STATE statePrev = state; switch (state) { case COMBAT_STATE.IDDLE: if (input_attack1 == INPUT_STATE.DOWN) { state = COMBAT_STATE.BASIC_ATTACK1_CHARGING; input_attack1 = 0; } break; case COMBAT_STATE.BASIC_ATTACK1_CHARGING: animationTimer++; if (animationTimer >= state1_Charging) { state = COMBAT_STATE.BASIC_ATTACK1_CHARGED; } if (input_attack1 == INPUT_STATE.RELEASED) { if (state == COMBAT_STATE.BASIC_ATTACK1_CHARGED) { state = COMBAT_STATE.BASIC_ATTACK1_STRONG; } else { state = COMBAT_STATE.BASIC_ATTACK1_WEAK; } input_attack1 = 0; } break; case COMBAT_STATE.BASIC_ATTACK1_CHARGED: if (input_attack1 == INPUT_STATE.RELEASED) { state = COMBAT_STATE.BASIC_ATTACK1_STRONG; weaponRight.transform.localScale = new Vector3(4, 4, 1.2f); input_attack1 = 0; } break; case COMBAT_STATE.BASIC_ATTACK1_WEAK: animationTimer++; if (animationTimer >= animationTimerEnd) { state = COMBAT_STATE.IDDLE; } break; case COMBAT_STATE.BASIC_ATTACK1_STRONG: animationTimer++; if (animationTimer >= animationTimerEnd) { state = COMBAT_STATE.IDDLE; weaponRight.transform.localScale = new Vector3(1, 1, 1); } break; } if (statePrev != state) { // Init(); animationTimer = 0; animationTimerEnd = animationEnd[(int)state]; } }