void Update() { if (!puncher.IsBusy()) { current_behavior(); } }
void FixedUpdate() { current_speed = speed; if (doge_timer > 0) { current_speed *= doge; doge_timer -= Time.deltaTime; } else { wait_timer -= Time.deltaTime; } if (IsStunned()) { StunUpdate(Time.fixedDeltaTime); return; } if (puncher.IsBusy() || Game.GameOver) { return; } SetVisible(true); if (InputHandler.GetInput(InputHandler.Type.PUNCH, jid)) { puncher.Punch(); return; } if (InputHandler.GetInput(InputHandler.Type.DOGE, jid) && wait_timer <= 0) { doge_timer = dogeTime; wait_timer = dogeWait; } float x = InputHandler.GetHorizontal(jid) * current_speed; float y = InputHandler.GetVertical(jid) * current_speed; if (!Mathf.Approximately(x + y, 0)) { Walk(x, y); return; } animator.Play("player" + pid + "_standing"); }