예제 #1
0
    // Update is called once per frame
    void Update()
    {
        {
            /* #if UNITY_EDITOR
             *      varx = Input.GetAxisRaw("Horizontal"); //PreProcessros use Eitor to controll means it will not move through joystick
             #endif
             *
             #if UNITY_ANDROID
             *      varx = joystiick.Horizontal();   //PreProcessros use Android to control means it will move through joystick
             #endif */
        }

        if (transform.position.y < -9)
        {
            gamemanager.Restart();
        }

        varx = joystiick.Horizontal();
        Debug.Log(varx);
        rb.velocity = new Vector2(varx * movespeed, rb.velocity.y);

        Change();
        if (Input.GetKeyDown(KeyCode.G))
        {
            Jumpstate();
        }

        {
            /*if (Input.GetKeyDown(KeyCode.G) && grounded==true)
             * {
             *  rb.velocity = new Vector2(0, jumpforce);
             *  animationp.jump();
             *  animationp.NotIdel();
             *  grounded = false;
             * }   //jump
             * {
             *  //if (movespeed > 1f)
             *  //{
             *  //   speed = 2;
             *  // }
             *  //if (movespeed < 1f)
             *  // {
             *  //    speed = -1;
             *  // }
             * }//comment windows control*/
        }

        if (Input.GetKeyDown(KeyCode.D) && Input.GetKeyDown(KeyCode.Space))
        {
            animationp.Run();
            animationp.Fire();
        }
        if (Input.GetKeyDown(KeyCode.Space))
        {
            animationp.Fire();
            animationp.NotRun();
        }
        if (Input.GetKeyDown(KeyCode.D))
        {
            animationp.Run();
            animationp.Notfire();
        }
        if (transform.position.x > 70)
        {
            //Application.Quit();
            levelfailed.SetActive(true);
        }
    }