private void Awake() { // set collider to off hittrigger.enabled = false; pstate = PunchStates.Waiting; damage_output = min_damage; kb_output = min_kb; }
private void Hit_FSM() { //WAITING if (pstate == PunchStates.Waiting) { if (Input.GetButtonDown("Z")) { pstate = PunchStates.Pressed; NumPressed++; } } //PRESSED else if (pstate == PunchStates.Pressed) { if (Input.GetButton("Z")) { fsm_timer += Time.deltaTime; } if (Input.GetButtonUp("Z")) { if (fsm_timer > Charge_duration) { Debug.Log("Charge Punch"); pstate = PunchStates.Waiting; NumPressed = 0; hit(fsm_timer * 5, true); } else if (NumPressed >= NumRapid) { Debug.Log("Rapid Punch Finisher"); pstate = PunchStates.Waiting; NumPressed = 0; hit(3.0f, true); } else { Debug.Log("Rapid Punch"); pstate = PunchStates.Not_Pressed; hit(1f, false); } fsm_timer = 0; } } //NOT PRESSED BUT STILL IN COMBO MODE else if (pstate == PunchStates.Not_Pressed) { if (Input.GetButtonDown("Z")) { NumPressed++; pstate = PunchStates.Pressed; fsm_timer = 0; } else { if (fsm_timer < Rapid_duration) { fsm_timer += Time.deltaTime; } else { pstate = PunchStates.Waiting; NumPressed = 0; fsm_timer = 0; } } } else { pstate = PunchStates.Waiting; } }