예제 #1
0
    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");
    }
예제 #2
0
    private void Update()
    {
        if (Input.GetButtonDown("punch" + playerNum))
        {
            puncher.Punch();
        }

        if (Input.GetButtonDown("use" + playerNum))
        {
            user.Use();
        }
        if (Input.GetButtonUp("use" + playerNum))
        {
            user.StartUse();
        }
        mover.SetDirection(Input.GetAxisRaw("Horizontal" + playerNum), Input.GetAxisRaw("Vertical" + playerNum));
    }
예제 #3
0
 private void Punch()
 {
     puncher.Punch();
 }