Exemplo n.º 1
0
 public void Dash()
 {
     if (direction == "left")
     {
         playerCommand.Dash(new Vector2(-DASH_FORCE, 0));
     }
     else if (direction == "right")
     {
         playerCommand.Dash(new Vector2(DASH_FORCE, 0));
     }
 }
Exemplo n.º 2
0
    /// <summary>
    /// 太刀状態
    /// </summary>
    void Stand()
    {
        gameObject.transform.position = new Vector3(gameObject.transform.position.x, 0, 0);

        int move = 0;

        speed = walkSpeed;

        //左右移動する
        if (direction == 1)
        {
            if (playerCommand.InputDKey == 6 || playerCommand.InputDKey == 9)
            {
                move = 1;
            }
            if (playerCommand.InputDKey == 4 || playerCommand.InputDKey == 7)
            {
                move = -1;
            }
            //右向き
            transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y, 1);
        }
        else
        {
            if (playerCommand.InputDKey == 6 || playerCommand.InputDKey == 9)
            {
                move = -1;
            }
            if (playerCommand.InputDKey == 4 || playerCommand.InputDKey == 7)
            {
                move = 1;
            }

            //左向き
            transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y, -1);
        }

        //下が押されたらしゃがみ
        if (playerCommand.InputDKey <= 3)
        {
            state = "Sit";
        }

        // 移動する向きを求める
        finalMove = new Vector3(move, 0, 0).normalized *speed;

        if (direction == 1)
        {
            animator.SetInteger("Move", move);
        }
        else
        {
            animator.SetInteger("Move", move * -1);
        }
        animator.SetInteger("Special", 0);
        animator.SetBool("Guard", false);
        animator.SetBool("Sit", false);
        animator.SetBool("Punch", false);
        animator.SetBool("Kick", false);
        animator.SetBool("Dash", false);
        animator.SetBool("Jump", false);
        animator.SetInteger("Damage", 0);

        //上が押されたらジャンプ
        if (playerCommand.InputDKey >= 7)
        {
            nowGravity = 0;
            state      = "Jump";
            Vector3 pos = transform.position;
            Instantiate(jumpEffect, pos, Quaternion.identity);
            //animator.SetBool("Jump", true);
        }

        //立ち状態時にZを押すとパンチ
        if (playerCommand.PunchKey)
        {
            animator.SetBool("Punch", true);
            playSEScript.PlayVoice((int)PlaySEScript.VoiceData.ATTACK1);
            playSEScript.PlaySE((int)PlaySEScript.SEData.ATTACK1);
            state = "Punch";
        }
        //立ち状態時にXを押すとキック
        if (playerCommand.KickKey)
        {
            animator.SetBool("Kick", true);
            playSEScript.PlayVoice((int)PlaySEScript.VoiceData.ATTACK2);
            playSEScript.PlaySE((int)PlaySEScript.SEData.ATTACK2);
            state = "Kick";
        }

        playerCommand.Dash();
    }