コード例 #1
0
    // Personaje caminando
    public void Walk(int direction)
    {
        Vector3 movement = new Vector3(direction, 0f, 0f);

        transform.position += movement * Time.deltaTime * character.stats.moveSpeed;
        character.stats.superPowerActive = false;
        character.stats.characterAttack  = false;
        if (direction == 1)
        {
            transform.localRotation = Quaternion.Euler(0, 0, 0);
        }
        else
        {
            transform.localRotation = Quaternion.Euler(0, 180, 0);
        }

        if (groundcheck.onGround == true)
        {
            animations.walkAnimation();
            state = states.WALKING;
        }
        else
        {
            animations.jumpAnimation();
            state = states.JUMPING;
        }
    }