예제 #1
0
    void Update()
    {
        float horizontal         = Input.GetAxis("Horizontal");
        float vertical           = Input.GetAxis("Vertical");
        bool  xDownKey           = Input.GetKeyDown(KeyCode.X);
        bool  joyInteractDownKey = Input.GetKeyDown("joystick button 1");

        if (xDownKey || joyInteractDownKey)
        {
            if (playerPushing == false && playerTouching)
            {
                Childer();
            }
            else
            {
                if (playerPushing)
                {
                    UnChild();
                }
            }
        }

        if ((horizontal != 0 || vertical != 0) && playerPushing)
        {
            player.podeCorrer = false;
            player.Cansa();
            player.speed = pushSpeed;
            if (player.cansado == true)
            {
                UnChild();
                player.podeCorrer = true;
            }
        }
    }