Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (playerBuff.ATK_BUFF())
        {
            ATK_text.enabled = true;
        }
        else
        {
            ATK_text.enabled = false;
        }

        if (playerBuff.DFS_BUFF())
        {
            DPS_text.enabled = true;
        }
        else
        {
            DPS_text.enabled = false;
        }

        if (playerBuff.SPD_BUFF())
        {
            SPD_text.enabled = true;
        }
        else
        {
            SPD_text.enabled = false;
        }
    }
Exemplo n.º 2
0
    void Move(float h, float v)
    {
        if (9.2f <= playerSkill.AccelCool && playerSkill.AccelCool < 10)
        {
            speed = 20f;
        }
        else
        {
            if (playerBuff.SPD_BUFF())
            {
                speed = 10f;
            }
            else
            {
                speed = 5f;
            }
        }


        if (h == 0 && v == 0)
        {
            movement.Set(0, 0, 0);
        }

        if (h < 0)
        {
            movement = -transform.right;
        }
        else if (h > 0)
        {
            movement = transform.right;
        }
        if (v < 0)
        {
            movement = -transform.forward;
        }
        else if (v > 0)
        {
            movement = transform.forward;
        }

        if (playerJump == true)
        {
            timer += Time.deltaTime;

            if (!contact)
            {
                jumpState = (int)Jump_State.JUMPING;
            }
            else if (h == 0 && v == 0 && jumpState != (int)Jump_State.JUMPING)
            {
                jumpState = (int)Jump_State.DEFAULT;
            }
            else if (jumpState != (int)Jump_State.JUMPING)
            {
                jumpState = (int)Jump_State.MOVE;
            }

            if (contact && timer > 1f)
            {
                playerJump = false;
                jumpState  = (int)Jump_State.NOT;
                timer      = 0;
            }

            switch (jumpState)
            {
            case (int)Jump_State.DEFAULT:
                transform.GetComponent <Rigidbody>().AddForce(new Vector3(0f, 1f, 0f) * 800);
                jumpState = (int)Jump_State.JUMPING;
                break;

            case (int)Jump_State.MOVE:
                transform.GetComponent <Rigidbody>().AddForce((new Vector3(0f, 1f, 0f) + movement) * 800);
                jumpState = (int)Jump_State.JUMPING;
                return;

            case (int)Jump_State.JUMPING:
                return;
            }
        }

        movement = movement.normalized * speed * Time.deltaTime;

        playerRigidbody.MovePosition(transform.position + movement);
    }