示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (!doMove)
        {
            return;
        }

        if (NInput.TouchBegan())
        {
            Joystick.SetPivot();
            PlayerPos = Player.localPosition;
        }

        if (NInput.TouchEnded())
        {
        }

        if (NInput.IsScreenTouched())
        {
            Speed += Time.deltaTime * Acceleration;
            Joystick.Update();
        }
        else
        {
            Speed -= Time.deltaTime * Acceleration * 2f;
        }

        Speed = Mathf.Clamp(Speed, MinSpeed, !IsInFastLane() ? MaxSpeed : MaxSpeed + FewerBoost);
        Dist += Time.deltaTime * Speed;

        if (Dist >= Track.length)
        {
            dist = 30f;
        }

        SetPositionOnDistance();

        if (isFewer)
        {
            Trail.emitting = true;

            if (Time.time > NextSpeedUp)
            {
                FewerBoost += 10f;
                Speed      += 10f;
                NextSpeedUp = Time.time + 2f;
            }
        }
        else
        {
            FewerBoost     = 20f;
            Trail.emitting = false;
        }
    }
示例#2
0
    private void Update()
    {
        if (NInput.TouchBegan())
        {
            Joystick.SetPivot();
            PlayerPos = Rb.position;
            Input     = true;
        }

        CarManager.CountFlips();

        if (NInput.TouchEnded())
        {
            Input = false;
        }

        UIManager.Progress(transform.position.z / LevelGenerator.path.end.z);
    }