Exemplo n.º 1
0
    void FixedUpdate()
    {
        if (IsDown)
        {
            _secondCounter += Time.deltaTime;
            if (_secondCounter >= delay)
            {
                if (IsEnterPlast)
                {
                    sensitivity = 2f;
                    dx         += joystick.Vertical * sensitivity * Time.deltaTime;
                    dz         += joystick.Horizontal * sensitivity * Time.deltaTime;
                }
                else
                {
                    dx = joystick.Vertical * sensitivity * Time.deltaTime;
                    dz = joystick.Horizontal * sensitivity * Time.deltaTime;
                }

                Vector3 direction = new Vector3(Position.x + dx, Position.y - spaceBetweenPipe, Position.z + dz);
                Position = direction;
                _pipes.CreatePipe(direction, Quaternion.identity);

                _deadZone.GetOut(direction);

                _secondCounter = 0;
            }
        }
    }