コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.IsJumpPressed())
        {
            SceneManager.LoadScene(SceneName);
        }

        if (ZoomIn)
        {
            JumpImage.transform.localScale = Vector3.MoveTowards(JumpImage.transform.localScale, new Vector3(0.9f, 0.9f, 0.9f), Time.deltaTime * Speed);
        }

        if (ZoomOut)
        {
            JumpImage.transform.localScale = Vector3.MoveTowards(JumpImage.transform.localScale, new Vector3(1f, 1f, 1f), Time.deltaTime * Speed);
        }

        if (JumpImage.transform.localScale.x <= 0.98f && JumpImage.transform.localScale.y <= 0.9f)
        {
            ZoomOut = true;
            ZoomIn  = false;
        }

        if (JumpImage.transform.localScale.x >= 1f && JumpImage.transform.localScale.y >= 1f)
        {
            ZoomOut = false;
            ZoomIn  = true;
        }



        if (RotateLeft)
        {
            LogoImage.transform.rotation = Quaternion.RotateTowards(LogoImage.transform.rotation, Quaternion.Euler(0f, 0f, -7f), Time.deltaTime * RotationSpeed);
        }

        if (RotateRight)
        {
            LogoImage.transform.rotation = Quaternion.RotateTowards(LogoImage.transform.rotation, Quaternion.Euler(0f, 0f, 7f), Time.deltaTime * RotationSpeed);
        }

        // todo: why this number?
        if (LogoImage.transform.rotation.z <= -0.061f)
        {
            RotateRight = true;
            RotateLeft  = false;
        }

        if (LogoImage.transform.rotation.z >= 0.061f)
        {
            RotateRight = false;
            RotateLeft  = true;
        }
    }
コード例 #2
0
    void Update()
    {
        Vector2 directionalInput = new Vector2(gamepadInput.GetLeftHorizontalValue(), 0);

        player.SetDirectionalInput(directionalInput);

        if (gamepadInput.IsJumpPressed())
        {
            player.OnJumpInputDown();
        }
        if (gamepadInput.IsJumpReleased())
        {
            player.OnJumpInputUp();
        }
    }